Skip to content

Instantly share code, notes, and snippets.

View technolaaji's full-sized avatar
👨‍💻
deletes code for no reason

Mohamad Kalaaji technolaaji

👨‍💻
deletes code for no reason
View GitHub Profile
@technolaaji
technolaaji / gist:4c77f39663c67b783247b6e842bc2ec7
Created June 22, 2020 19:48
React Hooks - Redux Example and Context Example for Hooks
Here is an small example of the issues I face when using Redux and Redux Toolkit with other libraries hooks
keep in mind that it is something I have been facing for quite some time, if you have a better solution then go ahead I am all ears here (really)
maybe I am not using Redux properly or misusing it or there might be a better way of handling this situation but I am up for feedback and suggestions
hooks like useNavigate from @reach/router or toast from react-toastify expect to be found within a Provider (which is expected)
my coding pattern is that when I write my dispatch functions, I tend to write them away from the component and import it as a single function
that perform everything under the hood, keeping my components more readable and clean to look at