Tutorial - Breve Introducción a Redux

3

  • 93
  • 0
  • 2.398
  • Reply

  • Open in the desktop app ADD TO PLAYLIST

    jfdesousa7

    Published on May 20, 2022
    About :

    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())

    Tags :

    programming technology development geek geekzone programacion developspanish

    Woo! This creator can upvote comments using 3speak's stake today because they are a top performing creator! Leave a quality comment relating to their content and you could receive an upvote worth at least a dollar.

    Their limit for today is $0!
    Comments:
    Time until jfdesousa7 can give away $0 to their commenters.
    0 Days 0 Hours 0 Minutes 0 Seconds
    Reply:

    To comment on this video please connect a HIVE account to your profile: Connect HIVE Account

    More Videos

    02:23
    11 views 6 months ago $
    00:50
    0 views 6 months ago $
    19:10
    39 views 2 months ago $