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
Why this example cannot work? <oc-component href="//localhost:3031/app-header/1.0.0" name="Example"/>
Every change on the url for the context.params seems too heavy, doesnt it?
Example:
I have two components, one of them includes the other (lets say todo list, and todo item), and now the only one the list can update the item is by updating the url of the component, which seems a bit strange
I see. Consider that the idea behind the OC is that it should wrap all business of a specific domain. For instance, in your example, I would imagine having a unique OC for the todo list, which perhaps would then wrap a todolist react component with nested list item react components, but I wouldn't have a todolist item in OC, I guess. Hopefully that makes sense? Just wanting to make sure we are on the same page with this concept.
In any case, what you propose could be technically possible but I fear it could raise some issues. For instance, the oc component tag is something you put in your page as is (rather than being webpacked like JSX) this means that for instance in your example, the "name" attribute would also be seen as name attribute by the browser. This means that id would need to be page unique, and other of these constraints. This is why we have been sticking with the href thing for a very long time, it's simple, possibly not nice but kind of works in its simplicity 👍
@nickbalestra perhaps you can add your opinion here if you have any?
The whole idea behind the "Micro Frontends" concept is that all the components can seamlessly integrate with each other, doesnt it?
So attributes is natural way to pass data into component, as every library supports it (not only react, but also angular, vue, and vanilla web components)
Updating a url string should also include a library or any piece of code to translate it back and forth to a proper object (serializing, deserializing) and it takes unnecessary calculation time :)
Even a OC that will be a todo list will have a special props he will need, for example simple filters controlled by other OC.
Currently this approach seems a bit wierd to me, bu maybe its only my (and i might go with a solution that will allow me to "install" plugin that will enable that) :)
Activity
matteofigus commentedon Aug 6, 2018
I see. Consider that the idea behind the OC is that it should wrap all business of a specific domain. For instance, in your example, I would imagine having a unique OC for the todo list, which perhaps would then wrap a todolist react component with nested list item react components, but I wouldn't have a todolist item in OC, I guess. Hopefully that makes sense? Just wanting to make sure we are on the same page with this concept.
In any case, what you propose could be technically possible but I fear it could raise some issues. For instance, the oc component tag is something you put in your page as is (rather than being webpacked like JSX) this means that for instance in your example, the "name" attribute would also be seen as name attribute by the browser. This means that id would need to be page unique, and other of these constraints. This is why we have been sticking with the href thing for a very long time, it's simple, possibly not nice but kind of works in its simplicity 👍
@nickbalestra perhaps you can add your opinion here if you have any?
avihaymenahem commentedon Aug 12, 2018
The whole idea behind the "Micro Frontends" concept is that all the components can seamlessly integrate with each other, doesnt it?
So attributes is natural way to pass data into component, as every library supports it (not only react, but also angular, vue, and vanilla web components)
Updating a url string should also include a library or any piece of code to translate it back and forth to a proper object (serializing, deserializing) and it takes unnecessary calculation time :)
Even a OC that will be a todo list will have a special props he will need, for example simple filters controlled by other OC.
Currently this approach seems a bit wierd to me, bu maybe its only my (and i might go with a solution that will allow me to "install" plugin that will enable that) :)
[-]Pass oc-component props to react component?[/-][+]Pass oc-component props to component?[/+]