Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-state-with-callback

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-state-with-callback - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

package.json
{
"name": "use-state-with-callback",
"version": "2.0.1",
"version": "2.0.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -13,2 +13,4 @@ # useStateWithCallback React Hook

**useStateWithCallback:**
```

@@ -35,2 +37,6 @@ import React from 'react';

const handleClick = () => {
setCount(count + 1);
};
return (

@@ -40,3 +46,3 @@ <div>

<button type="button" onClick={() => setCount(count + 1)}>
<button type="button" onClick={handleClick}>
Increase

@@ -49,13 +55,46 @@ </button>

**useStateWithCallbackLazy:**
```
import React from 'react';
import { useStateWithCallbackLazy } from 'use-state-with-callback';
const App = () => {
const [count, setCount] = useStateWithCallbackLazy(0);
const handleClick = () => {
setCount(count + 1, (currentCount) => {
if (currentCount > 1) {
console.log('Threshold of over 1 reached.');
} else {
console.log('No threshold reached.');
}
});
};
return (
<div>
<p>{count}</p>
<button type="button" onClick={handleClick}>
Increase
</button>
</div>
);
};
export default App;
```
## Contribute
* `git clone git@github.com:the-road-to-learn-react/use-state-with-callback.git`
* `cd use-state-with-callback`
* `npm install`
* `npm run test`
- `git clone git@github.com:the-road-to-learn-react/use-state-with-callback.git`
- `cd use-state-with-callback`
- `npm install`
- `npm run test`
### More
* [Publishing a Node Package to NPM](https://www.robinwieruch.de/publish-npm-package-node/)
* [Node.js Testing Setup](https://www.robinwieruch.de/node-js-testing-mocha-chai/)
* [React Testing Setup](https://www.robinwieruch.de/react-testing-tutorial/)
- [Publishing a Node Package to NPM](https://www.robinwieruch.de/publish-npm-package-node/)
- [Node.js Testing Setup](https://www.robinwieruch.de/node-js-testing-mocha-chai/)
- [React Testing Setup](https://www.robinwieruch.de/react-testing-tutorial/)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc