Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Using rest props as element attributes #29

Closed
Vovan-VE opened this issue Dec 12, 2018 · 2 comments
Closed

Using rest props as element attributes #29

Vovan-VE opened this issue Dec 12, 2018 · 2 comments

Comments

@Vovan-VE
Copy link
Contributor

Hello.

I use <OnVisible/> to render comments tree for a forum topic. Each single comment is an <OnVisible/> instance. I wish to add, for example, an id attribute to the element, but there are no ability for that. Now I just add extra wrapper element only to add id to it, but this is +1 nested elements on each reply level. I need an id attribute to whole element containing a comment, not to any part of a comment.

<OnVisible
    onChange={handler}
    wrappingElement="article"
    className="..."
    id={`comment-${id}`}
/>

Someone else would to add some other attributes like data-* or title. Someone else would to use a or img element directly without an extra wrapper element.

<OnVisible wrappingElement="a" href="..." title="..."/>
<OnVisible wrappingElement="img" src="..." alt="..."/>

There are a common practice to use ...rest props for root element's attributes.

@dazld
Copy link
Owner

dazld commented Dec 12, 2018

that seems like a good enhancement - if you'd like to have a go at a PR, that would be great!

@dazld
Copy link
Owner

dazld commented Dec 16, 2018

Fixed in #30

@dazld dazld closed this as completed Dec 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants