-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Descriptor warning because willTransitionFrom receives descriptor, not instance #47
Comments
Absolutely. I realize we're doing this wrong, and welcome any insight you can provide on how to do this correctly. The difference between component instances and descriptors has been one of the most difficult things to work with while building this library. We even have a few warnings in our tests because we're using descriptors instead of instances. Looking over the cloneWithProps API, it doesn't look like it's intended to be used with descriptors. How should we get a handle on the real components? |
We could move willTransitionFrom to the actual component maybe? Sent from my iPhone
|
had a conversation with @sebmarkbage, the only way to get a handle on the actual instance is the return value of I'm thinking we can maybe add a ref here, which can simply be the name of the route: https://github.com/rpflorence/react-nested-router/blob/master/modules/components/Route.js#L442 And then instead of storing it on https://github.com/rpflorence/react-nested-router/blob/master/modules/components/Route.js#L387 |
Right – with the new refs (not landed yet), you will be able to do something like:
and then use |
@rpflorence Where would we get Maybe we need a |
We can bank on the root route I think, can't we? On Wed, Jun 25, 2014 at 2:15 PM, Michael Jackson notifications@github.com
|
Not really. The current API delegates to users to call If we went one level higher we could get a handle on the components themselves, or we could wait until the new refs @spicyj mentioned land in React proper. |
Not quite true – in the componentWillMount and componentDidMount hooks for the top-level |
@spicyj Ah, good to know. We may be able to work with that. |
I'm getting this warning when checking state in my component's |
thanks for the reminder to release something :) I just published v0.2.1 On Mon, Jul 14, 2014 at 10:21 AM, Nick Williams notifications@github.com
|
I was hoping it'd be a welcomed reminder :-) Thanks, I'll test tomorrow. |
Worked a treat, thanks |
The transitions example currently gives this console warning when switching away from the dashboard page:
because of the line
in transitions/app.js, but the router passes the component descriptor (basically just
type
andprops
) to the willTransitionFrom function.In React master, I don't believe the example will work at all because descriptors and components have been more properly separated. If the intention is for willTransitionFrom to receive the actual component instance, your best approach is probably to use cloneWithProps in conjunction with new-style refs (facebook/react#1554) after that lands.
The text was updated successfully, but these errors were encountered: