Possible to display code within a conditional statement?
jackarmley opened this issue · 2 comments
For something like:
{this.state.show && (
<Component />
)}
would it be possible to have another option to display this code?
Hello @jackarmley,
I suppose this condition example is from a render
method (or in a functional component). If that the case, we do not have access to it actual implementation. We only have a reference to the component class (or the render function).
The objective of react-element-to-jsx-tree
is not to render the result of the render (witch could be obtain by a ReactDOM.render(element, container)
call), nor to print the implement detail of a component, but to dump back a React.Element
tree to a valid JSX (for debug purpose, or re-execution).
I will close this issue as we could not implement it. Please let me know if you think this should be reopened.
Thanks
Thanks for such a detailed reply @Spy-Seth this makes sense. Our case is a little niche as we're building a docs site.