kitze/mobx-router

store in undefined when I use .goTo

ekokotov opened this issue · 3 comments

When I reload the page with this route, everything is ok. but when I redirect using .goTo store in always undefined

Seems like I had to pass store in .goTo ;(.
I had to extend your router and pass my root store to .goTo

thdk commented

@ekokotov When your Route doesn't use the storeargument in any of it's lifecycle methods, you don't need to pass store to goTo. However, as soon as one of your lifecycle methods (onEnter, onExit, beforeEnter,...) use the store argument, then you must always pass the store when calling goTo.