yandex / reselector

Use React Components in css selectors
https://npm.im/reselector
Other
45 stars 10 forks source link

Use Component's hash if it was used as a root #10

Closed lttb closed 6 years ago

lttb commented 6 years ago

Let's say we've got Component like

const SuperText = () => (
    <Text>
        my super text
    </Text>
)

So reselector will add data-hash to the root component Text, and if it doesn't pass rest props to the DOM node, it will be applied only the one data-hash, generated just for the Text.

And for now you can find SuperText only by select`.smth ${Text}`.

The solution is to use Text's data-hash for the root node, and we can use select`.smth ${SuperText}` then

nickshevr commented 6 years ago

I have an idea about it.

Think in this case we could set both of data attrs to Text DOM Node:

It is much better than set only one of these.