Use const for Action Types - explanation lacking?

Use const for Action Types - explanation lacking?
0

#1

I have a comment on this challenge.
I understand the reason for setting action types as constants.
It’s to avoid typos that won’t be picked up in the IDE.
My issue is the challenge doesn’t explain why, other than saying “it’s a common practice”.
I think the reasons for doing this need explaining better.

Your code so far


// change code below this line

// change code above this line

const defaultState = {
  authenticated: false
};

const authReducer = (state = defaultState, action) => {

  switch (action.type) {

    case 'LOGIN':
      return {
        authenticated: true
      }

    case 'LOGOUT':
      return {
        authenticated: false
      }

    default:
      return state;

  }

};

const store = Redux.createStore(authReducer);

const loginUser = () => {
  return {
    type: 'LOGIN'
  }
};

const logoutUser = () => {
  return {
    type: 'LOGOUT'
  }
};

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/use-const-for-action-types/