@blockle/react-redux
v0.0.1-alpha.2
Published
ReactRedux hooks
Downloads
5
Readme
@blockle/react-redux
Drop in replacemenet for react-redux when only using hooks.
Install
yarn add @blockle/react-redux
Usage
import React from 'react';
import { Store } from 'redux';
interface Props {
children: React.ReactNode;
store: Store;
}
const AppShell = ({ children }) => {
return (
<Provider store={store}>
{children}
</Provider>
);
}
const MyComponent = () => {
const dispatch = useDispatch();
const item = useSelector((state) => state.userName);
return (
<div>
{userName}
<button onClick={() => dispatch(randomizeName())}>
Randomize name
</button>
</div>
)
}