Function as children display
See original GitHub issueHi,
is react-element-to-jsx-string
able to output/format a “Function as children”? (More infos)
const Foo = (props) => (
<div>
{props.children()}
</div>
);
const Bar = () => (
<Foo>{() => (
<span>Yeah</span>
)}</Foo>
);
Output from react-element-to-jsx-string
:
<Foo />
Expected output:
<Foo>{() => (
<span>Yeah</span>
)}</Foo>
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Using Functions as Children and Render Props in React ...
Children as a function is technically a render prop. However render props allow you to define a complex component and expose dynamic abilities....
Read more >Function as Child Components Are an Anti-Pattern
A Function as Child Component (or FaCC) is a pattern that lets you you pass a render function to a component as the...
Read more >CHILDREN Function - Smartsheet Learning Center
Used within another function to reference the child rows of the referenced parent row.
Read more >React Children And Iteration Methods - Smashing Magazine
Children. toArray , that React gives us, which helps to iterate over the children in a way which ensures performance and determinism. The...
Read more >Using Children in React - We Learn Code
</Button> and then a button with the text click me would display on the page. For a layout, I could do something like:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bnjmn-jns This looks like a different issue your describing, more to do with HOC’s and
displayName
. Quick fixText.displayName = 'Text';
More thorough: https://github.com/algolia/react-element-to-jsx-string#reactelementtojsxstringreactelement-options
https://github.com/algolia/react-element-to-jsx-string/blob/master/src/parser/parseReactElement.js#L12-L17
Closing this since for being idle. If you want to work on that @pascalduez, feel free to reopen an issue with more details