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

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -