-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support React Context #19
Comments
Another potential issue is the fact that we are calling So my inclination is not mix handlebars and react together. In other words, making sure to only call The downside is that we will loose the UI routing capabilities of ember potentially replacing it with react router? I wonder what are the implications of having only the |
Interesting idea, and I can see this working for cases where you're trying to transition from one framework to the other over time. However, if you're looking to really mix the two, that's not a reasonable solution. I'll explore the APIs that React makes available a bit more and see what I can do. The "sharing state" problem is inherently approached differently between React and Ember -- React introduced Context to share state without passing props, and Ember has services for largely the same reason (which are supported in React components). I wonder if the Context issue could somehow be solved using a service that the addon provides... I'll look into this a bit more. I don't know a lot about React context (yet!) |
cool. that sounds great. |
Let's assume the following example:
my-app
is a react component that uses the new context API to set values to be shared across children.app-header
is another react component that should be able to read frommy-app
context.outlet
is not a react component.From what I understand, this addon will first mount
app-header
and thenmy-app
(behind the scenesyield-wrapper
is being used to create the children to be passed tomy-app
).Since
app-header
is mounting first, it never gets a chance to receive the context values that will be set by its parent. In react, the order is different,my-app
render is called first, thenapp-header
render is called.I've tried for a couple of hours to fix this issue. But, I don't think we will be able to fix it if the order is reversed.
The text was updated successfully, but these errors were encountered: