how to ignore ordering of reselect selectors when composing selectors -


as compose more selectors together, i'm finding i'm reordering selectors defined. example,

export const selectnav = state => state.nav; export const selectpage = state => state.page;  export const selectnavandpage = createselector([     selectnav,     selectpage, ], (nav, page) => {  });  export const selectfoo = state => state.foo;  export const selectnavandpageandfoo = createselector([     selectnavandpage,     selectfoo, ], (navandpage, foo) => {  }); 

this simple example, not define selectnavandpage below selectnavandpageandfoo. more selectors composed , selectors of selectors composed, need make sure sub-selectors defined @ top before use them.

is there way create these selectors such ordering doesn't matter?

i worried same problem , created npm module define-selectors. module delays definition of selector solve ordering of selector definition problem , adds other features it. has not been stable yet, use on project make stable , improved.

for more information please go github page , read readme , source files.


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -