I'm just curious, is it also a good thing to only pass a string/text in property children of a React component?
For example:
...
<SampleComponent children={'Confirm'}/>
...
I'm just curious, is it also a good thing to only pass a string/text in property children of a React component?
For example:
...
<SampleComponent children={'Confirm'}/>
...
Not a stone written best practice but the children prop in React is globally used to render a slot in the component.
So it is more common to see this kind of children syntax:
<SampleComponent>
Confirm
</SampleComponent>
than this one:
<SampleComponent children="Confirm" />
But at the end it's just a matter of taste. Both have exactly the same effect.
The name "children" in props is commonly used to refer to wrapped components when creating wrapper components. You should use more descriptive names in props, as in your situation probably "result"