- I tried to convert redx into redux hooks.
- so I researched and found this link https://medium.com/javascript-scene/do-react-hooks-replace-redux-210bab340672
- I was able to make few changes.
- but not able to proceed further.
- It would be great if you guys let me know for one component.
- I can do it for others. -If you uncomment Button export you can see working code without hooks
- providing my code snippet below.
https://codesandbox.io/s/boring-wu-btlre
function useHackerNews(props) {
const hackerNews = useSelector(state.channel);
const dispatch = useDispatch();
return (
<button
onClick={() => {
getPosts(channel);
getAlert();
}}
className="btn btn-primary btn-lg btn-block"
>
Get top news
</button>
);
}