-
Notifications
You must be signed in to change notification settings - Fork 52
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
Using same component on different routes #123
Comments
It should work. |
Hmm… Im still not that convinced yet :/ Having this :
I think I had the same problem on the initial question. If I was on /item/xxx and that I go to /item/zzz, @resolve is triggered, I do get a new render for the component, but the child component will not receive the new prop — which feels buggy. The componentWillReceiveProps of the child is not triggered. So it differs from the example you're pointing out as i'm using (maybe by mistake) a child component I first though it was simply the fact of using a |
@bbnnt When the url changes you should check that in the @resolve('company', (props) => {
const { companySlug } = props.params
return props.getCompany(companySlug).then(payload => payload)
})
export class Company extends React.Component {
componentWillReceiveProps(nextProps) {
const { params: { companySlug }, getCompany } = this.props
const { params: { companySlug: newCompanySlug } } = nextProps
if (newCompanySlug !== companySlug)
getCompany(newCompanySlug)
}
}
In my example |
Hi; went through the issues but could not really find out :/
I have a component that renders a list, this list can be filtered (
/items
,/items/campaigns
,/items/posts
, etc...) using react-router. Each 'url filter' should call an api endpoint with specific params and obviously re-render the (same) component listing the correct items after the requestSome code here :
I can get react-resolver return the results when reaching the page server side, but then if i navigate from one to another 'url-filter', nothing happens. I see that
componentWillReceiveProps
is triggered, but react-resolver won't fetch again the correct data.I was wondering if it was to be expected, happy to be notified if I was using it wrong (assuming I've been clear enough in the use case I'm exposing above). best
The text was updated successfully, but these errors were encountered: