Skip to content
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

Pass oc-component props to component? #922

Open
avihaymenahem opened this issue Aug 6, 2018 · 2 comments
Open

Pass oc-component props to component? #922

avihaymenahem opened this issue Aug 6, 2018 · 2 comments

Comments

@avihaymenahem
Copy link

avihaymenahem commented Aug 6, 2018

Who is the bug affecting?

Every component

What is affected by this bug?

Communication between components

When does this occur?

When generating new component on page

Where on the platform does it happen?

client

How do we replicate the issue?

Pass custom prop to oc-component tag

Expected behavior (i.e. solution)

Pass down all props

Other Comments

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

@matteofigus
Copy link
Member

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
Copy link
Author

avihaymenahem commented 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) :)

@avihaymenahem avihaymenahem changed the title Pass oc-component props to react component? Pass oc-component props to component? Aug 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants