react-layer-stack icon indicating copy to clipboard operation
react-layer-stack copied to clipboard

Behaviour of "use" property in Layer component

Open antonfisher opened this issue 8 years ago • 1 comments

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?

antonfisher avatar Jan 04 '17 20:01 antonfisher

good points! I'm on the same page 👍

lexfrl avatar Jan 10 '17 16:01 lexfrl