Closed davshoward closed 1 year ago
Hey, love the plugin.
Was wondering if there was any way of detecting whether an element is the "first" child or not?
Specifically for the use case of a heading to be able to do something like this:
[NODE_HEADING]: (children, props) => { const { level } = props; const isFirstChild = ???; return ( <H {...level} spacing={isFirstChild ? 'b' : 'y'}> {children} </H> ); }
Cheers
No that's not possible, unfortunately. I don't know what your spacing prop does, but maybe CSS can help? (:first-child or :first-of-type)
:first-child
:first-of-type
No worries :-)
Hey, love the plugin.
Was wondering if there was any way of detecting whether an element is the "first" child or not?
Specifically for the use case of a heading to be able to do something like this:
Cheers