Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!