Skip to content

Pass oc-component props to component? #922

Open

Description

@avihaymenahem

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

Activity

  1. matteofigus commented on Aug 6, 2018

    @matteofigus
    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?

  2. avihaymenahem commented on Aug 12, 2018

    @avihaymenahem
    Author

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

  3. changed the title [-]Pass oc-component props to react component?[/-] [+]Pass oc-component props to component?[/+] on Aug 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions