freeCodeCamp/curriculum/challenges/spanish/03-front-end-libraries/redux/get-state-from-the-redux-st...

1.6 KiB

id title challengeType isRequired videoUrl localeTitle
5a24c314108439a4d403614c Get State from the Redux Store 6 false Obtener el estado de la tienda redux

Description

El objeto de tienda Redux proporciona varios métodos que le permiten interactuar con él. Por ejemplo, puede recuperar el state actual mantenido en el objeto de almacenamiento de Redux con el método getState() .

Instructions

El código del desafío anterior se reescribe más concisamente en el editor de código. Utilice store.getState() para recuperar el state de la store y asigne esto a una nueva variable currentState .

Tests

tests:
  - text: El almacén de redux debe tener un valor de 5 para el estado inicial.
    testString: 'assert(store.getState()===5, "The redux store should have a value of 5 for the initial state.");'
  - text: Debe existir una variable <code>currentState</code> y se le debe asignar el estado actual del almacén de Redux.
    testString: 'getUserInput => assert(currentState === 5 && getUserInput("index").includes("store.getState()"), "A variable <code>currentState</code> should exist and should be assigned the current state of the Redux store.");'

Challenge Seed

const store = Redux.createStore(
  (state = 5) => state
);

// change code below this line

Solution

// solution required