I'm trying to do nested conditionals to be rendered and one case would make me use .map()
renderClasses () {
if (!this.state.classes.length) {
console.log(this.state.userType)
if (this.state.userType) return(<div>Add Class</div>)
else return (<div>Join Class</div>)
} else {
return (<div>{
this.state.classes.map((class) => {
^ unexpected token here
<div>one class</div>
})
}</div>)
}
}
render() {
if (!this.state.isLogged) {
return <Redirect to='/' />
}
return (
<div>
{
this.renderClasses()
}
</div>
);
}
Am i missing something? i tried wrapping everything into one <div> or maybe I understood it wrong? Thank you in advance