![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-powerhooks
Advanced tools
⚠️ Warning: hooks are not part of a stable React release yet, so use this library only for experiments
](https://codesandbox.io/s/j31y1l90m3)
yarn add react-powerhooks
react-powerhooks
is a set of react custom-hooks equivalent to the render props components in react-powerplug
Heavily inspired by react-hangers
The logo is from wikimedia commons
This is a hook that lets you toggle between boolean values.
It needs an initialValue
to work with.
Usage
const initialValue = true;
const [currentValue, toggleAway] = useToggle(initialValue);
This hook lets you know when your mouse pointer is active on a particular element.
It needs a ref
of the element in question to work with. It can also take an onChange
callback which it calls everytime the active state changes. The onChange
function recieves the current active state of the element as a boolean value.
Usage
const ref = useRef(null); // Use the ref in the element concerned.
// More about useRef here https://reactjs.org/docs/hooks-reference.html#useref
const activeValue = useActive({ refEl: ref });
This hook starts an interval timer that can be stopped/resumed any time.
It takes in startImmediate
which decides whether the interval is on by default.
It also takes a time
which is the interval duration.
It provides a start
and stop
method which allow us to control the state of the interval.
Usage
const [time, setTime] = useState(null);
const { start, stop } = useInterval({
duration: 1000,
startImmediate: false,
callback: () => {
setTime(new Date().toLocaleTimeString());
}
});
return (
<Fragment>
<div>The time is now {time}</div>
<button onClick={() => stop()}>Stop interval</button>
<button onClick={() => start()}>Start interval</button>
</Fragment>
);
This hook allows you to use a map object and get methods to manipulate the map.
Takes an initialValue
Usage
const {
set: setKey,
get: getKey,
has,
delete: deleteKey,
clear,
reset,
values
} = useMap({ name: "PK", age: "30", occupation: "Reactor" });
FAQs
Hooks api for common powerplugs
The npm package react-powerhooks receives a total of 28 weekly downloads. As such, react-powerhooks popularity was classified as not popular.
We found that react-powerhooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.