Tutorial - Breve Introducción a Redux
En el día de hoy quiero hablar de Redux.js redux es una librería de js que nos permite gestionar todos los estados de nuestra App. Voy a explicar de manera introductoria y superficial como funciona el flujo de redux.
Index.js
const redux = require("redux")
const createStore = redux.createStore
const SUMAR = "SUMAR"
const initialState = {
valor: 0,
usuarios: [],
isLoading: false
}
const sumando = () => {
return {
type: SUMAR
}
}
const reducer = ( (state = initialState , action) => {
switch(action.type){
case SUMAR : {
return {
...state, valor: state.valor + 1
}
}
default: return state
}
})
const store = createStore(reducer)
console.log(" ESTADO INICIAL ", store.getState())
store.subscribe( () => console.log(" ACTUALIZANDO ESTADO ", store.getState()))
store.dispatch(sumando())
▶️ 3Speak
Leave Tutorial - Breve Introducción a Redux to:
Read more #programming posts
Best Posts From jfdesousa7
We have not curated any of jfdesousa7's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From jfdesousa7
- Today is selfie day 😌
- Strolling through "el Laguito" Park 🍃
- Probando la nueva actualizacion de NextJS 13
- Tennis day in the club (San Miguel / Maturin)
- My innocent puppy
- Aprende a subir tu aplicacion de NextJs a un Hosting Compartido (Cpanel)
- Severance - Everyone Should Watch the Absolute Best Show on Apple TV Plus
- Tutorial - React Redux App + Solidity desde cero. Metamask-Ethers
- Tutorial - Breve Introducción a Redux
- Parte 2 (Backend) - Aprende a crear una tienda virtual Blockchain aceptando ERC20 token