Connect to useDispatch and useSelector in Redux

Some advantages of this approach:

  • It looks neat and clean and the best part is that it doesn’t break the flow of code and you can read the entire component in a single flow without the need to scroll frantically.
  • And the props aren’t diluted with the store components, so props are actual props.
  • The need to define another set of functions to dispatch store actions is removed with this approach as you can just use the dispatch variable to dispatch the imported actions where it’s required.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store