React Hooks y Redux funcionando juntos

Integrando Redux con los React Hooks para simplificar nuestro código

Introducción

React Redux 7.1.0

Una aplicación básica con Redux

Image for post
Image for post
Image for post
Image for post
actions.js
Image for post
Image for post
configureStore.js
Image for post
Image for post
App.js
Image for post
Image for post

Refactorización de App.js

Image for post
Image for post
App.js in functional style

useSelector hook

const count = useSelector(store => store.count)
Image for post
Image for post
App.js con useSelector

useDispatch hook

Image for post
Image for post
App.js con useDispatch

Entonces, ¿los hooks reemplezarán a Redux?

Repositorio

¿Quieres recibir más artículos como este?

Written by

Entre paseo y paseo con Simba desarrollo en Symfony y React

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