I have a state variable which stores JSX code that will be rendered to the DOM in the render()
method.
Here is the structure of state and the state variable jsxComp
that I currently have,
state = {
isLoggedin: false,
jsxComp: null
}
What I am trying to do is I am trying to append JSX code ( a div ) into this variable inside a for loop as follows,
for(let i=0; i<postCount; i++){
this.setState({
//Append a div to the jsxComp variable
})
}
How can I do that? +
operator does not seem to work in this case.