react-layer-stack
react-layer-stack copied to clipboard
Behaviour of "use" property in Layer component
trafficstars
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?
good points! I'm on the same page 👍