I wanted to recursively add a react component from within its own component. I saw this example of a tree component which was mapping through the child TreeNodes and adding
If I create the child nodes as an object at the top of the render method, it works fine.
export default class extends React.Component { let replies = null if(this.props.replies){ replies = this.props.replies.map((reply) => { return ( ) }) } render() { return ( { replies } ) } }