@freakycoder/react-use-state-with-callback
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

React Use State with Callback

Battle Tested ✅

React Use State with Callback

npm version npm Platform - Android and iOS License: MIT styled with prettier

Installation

Add the dependency:

npm i @freakycoder/react-use-state-with-callback

Peer Dependencies

Zero Dependency

Usage

Import

import useStateWithCallback from "@freakycoder/react-use-state-with-callback";

Fundamental Usage

const [isSelected, setIsSelected] = useStateWithCallback<boolean>(false);

// USAGE
setIsSelected(true, (newValue: boolean) => console.log(newValue)); // true

Credits

Big thanks to MJ Studio from StackoverFlow. I just converted his awesome wrapper solution to a library.

MJ Studio's StackoverFlow Answer

Author

FreakyCoder, kurayogun@gmail.com

License

React Use State with Callback is available under the MIT license. See the LICENSE file for more info.

Package Sidebar

Install

npm i @freakycoder/react-use-state-with-callback

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

12.9 kB

Total Files

11

Last publish

Collaborators

  • freakycoder