Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
Are there any drawbacks to eliminating the defaultstore?

I am refactoring my code to eliminate the default store and use ES6+ defaults as follows:

That is I am moving defaults from an object passed in as follows:

const store = createStore(reducers, defaultstore, middleware);

to directly into the reducers. This way I can locate them easier. The two methods are shown below ...

defaultstore

  Menu: {
    current: 'Articles'
  },

reducer function

// People is the default
const Menu = (state = {current: 'People'}, action) => {
  const newState = { ...state };
  switch(action.type) {
  case 'updateMenu':
    newState.current = action.current;
    return newState;
  }
  return state;
};

Is there any reason not to do this. It makes the code more readable.

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda