0.0.1 • Published 5 years ago
use-self v0.0.1
React useSelf
hook (experimental)
Installation
npm install use-self
or
yarn add use-self
Usage
const Component = (props) => {
const [self, pushState] = useSelf(initialState);
if (self.mounted === false) {
self.state = 'a'
}
useEffect(() => {
pushState('b');
}, []);
return self.state;
};