You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to add router to my mobx-state-tree models to keep it consistent and not need to use withRouter all the time and bellow is my attempt to do so which fails (explained why latter on).
I start with RouterModel (this is react native project)
Or so I would think, I get error [ts] Cannot find name 'RouterModel'. inside my Props interface. I am sure something somewhere is done wrong, hence this question that can be broken down into following parts
How do I correctly create router model that inherits all types for history?
How do I correctly inject it into a Router component and pass down correct types to Props interface?
The text was updated successfully, but these errors were encountered:
Best to provide more complete example.
What is store? What is the createHistory?
And as it is, there are a few questionable stuff going on.
Notice that history (model should be named uppercase) should be plain data object as I understand it.
Side note regarding router, people now tend to use react-navigation and on the web these people that like to put router control in store, they not like the react-router4...
Issue seems inactive? Closing for now but with a little googling you will find some router solutions like the one suggested by @dbertella and https://github.com/kitze/rttr
I was trying to add router to my mobx-state-tree models to keep it consistent and not need to use
withRouter
all the time and bellow is my attempt to do so which fails (explained why latter on).I start with
RouterModel
(this is react native project)P.S I highly doubt that this line is correct
history: types.model(history)
I was trying to see if I can make model inherit all types from historyThis router model is than passed to
<Provider />
(theRouterModelDefault
bit) asrouter: RouterModelDefault
After this I can inject it in my router component like so
Or so I would think, I get error
[ts] Cannot find name 'RouterModel'.
inside myProps
interface. I am sure something somewhere is done wrong, hence this question that can be broken down into following partshistory
?Router
component and pass down correct types toProps
interface?The text was updated successfully, but these errors were encountered: