React. Children as prop

I know how to pass children to React component:

<Button block
        href={url}
        target="_blank"
        bsStyle="primary"
        bsSize="xsmall">Open This Wonderful Link</Button>

But can I use this way:

<Button block
        href={url}
        target="_blank"
        bsStyle="primary"
        bsSize="xsmall" 
        children="Open This Wonderful Link" />

It works, but is this normal? Can I use this way every time?

P.S. Sorry for my poor English..)

Upvotes: 6

Views: 3537

Answers (1)

Lingaraju E V
Lingaraju E V

Reputation: 503

Yes, children is like any other prop and can be used as a prop to render child components, instead of nesting child components in the respective element

Upvotes: 6

Related Questions