-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui-router do not propagate my resolve to the component #51
Comments
fyi, I am actually returning a component for the top is a |
From your code it looks like the I created a small webpackbin (https://www.webpackbin.com/bins/-Kktv-C_NIb0Ptsl_wSO) and everything works normally. Do you think you can reproduce the error/problem so I can take a better look? I don't have enough info right now. |
Thank you very much Marco.. |
Oh, I think I understand now. By doing () => <something /> // <- this is a stateless component The router injects the props to the component you declare in the state definition, that's the stateless component and not To fix this you should declare the state like this: component: FirstPage, This way you avoid creating the wrapper component. |
ohhh awesome, I get it now. Thank you 👍 |
I am pretty fresh in ui-router with react, I have a very simple example with two components. Top an Bottom
`
const Home = { name: 'top', component: () => (), url: '/' };
const Page1 = {
name: 'top.page1',
component: () => (),
resolve: [{
token: 'page1',
resolveFn: () => RootService()
}]
};
export const Routes: IStateRoute[] = [
Home,
Page1
]`
I am using axios for my http in RootService, so it simply returns axios.get('url')
then injecting my routes simply as
<UIRouter states={Routes} plugins={plugins}> <UIView/> </UIRouter>
The http fires and I can see it in my network in my web tools, if i place a loading component it even awaits for it until it resolves. nonetheless, the value of the resolve is not present in the props.resolves of the Page1 component.
I have red the documentation a couple of times and It does not seem I am missing anything.
Could you let me know what I might be doing odd?
The text was updated successfully, but these errors were encountered: