Redux - Write a Counter with Redux

Tell us what’s happening:
I just found out that this challenge passes with the last line leaving it null, where obviously it should use Redux.createStore()

const store = null;

Am I missing something or is it a wrong past test declaration?

Your code so far

const INCREMENT = 'INCREMENT'; // Define a constant for increment action types
const DECREMENT = 'DECREMENT'; // Define a constant for decrement action types

const counterReducer = (state = 0, action) => {
  switch(action.type) {
    case INCREMENT:
      return state + 1
    case DECREMENT:
      return state - 1
    default:
      return state
  }
}; // Define the counter reducer which will increment or decrement the state based on the action it receives

const incAction = () => {
  return {
    type: INCREMENT
  }
}; // Define an action creator for incrementing

const decAction = () => {
  return {
    type: DECREMENT
  }
}; // Define an action creator for decrementing

const store = null; // Define the Redux store here, passing in your reducers

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

Challenge: Redux - Write a Counter with Redux

Link to the challenge:

The test code creates its own store for the tests and the existence of a store in the editor code is not checked.

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/03-front-end-development-libraries/redux/write-a-counter-with-redux.md

I guess you can argue there might be a missing regex in the tests for the store. Maybe open an issue for it.

Thank you for your answer Lasjorg!

The test code creates its own store for the tests

  • that makes sense, thank you for explaining, will look into the issue ticket