Skip to content

Behaviour of "use" property in Layer component #10

@antonfisher

Description

@antonfisher

Hi Alexey,
I have some trouble with use option. My code was:

<Layer id="my-id">
  {() => <MyComponent item={item} />}
</Layer>

But MyComponent did not get changed after update parent's property item from item.children = ['a'] to item.children = ['a', 'b'].

I have fixed that by this code:

<Layer id="my-id" use={item.children}>
  {() => <MyComponent item={item} />}
</Layer>

May be it should be more predictable here.
For example, always return true in shouldComponentUpdate (https://github.com/fckt/react-layer-stack/blob/master/src/components.js#L61) if there is no use parameter defined by user and there is no way to detect children props changes.
What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions