I've been using this code
{this.state.display === true ?
this.state.content.map((q) => {
<Content
id={q.id}
key={q.id}
content={q.content}
deleteRow={this.deleteRow()}
/>
})
<AppForm />
inside my return method in React, everything works aslong as I dont add the AppForm,but when I add AppForm it gives me an error: Syntax error: Unexpected token.
Can you please help me? Thanks.
Edited:
I want both Content and AppForm to be shown if the user is logged in (display is true)
Here is my complete render code:
return (
<div>
{this.state.display === true ?
this.state.content.map((q) => {
<Content
id={q.id}
key={q.id}
content={q.content}
deleteRow={this.deleteRow()}
/>
})
<AppForm />
: this.state.display === false ?
<Forms
create={this.createUser}
sign={this.signUser}
/>
: 'Error'
}
</div>
);
this.deleteRow()should just bethis.deleteRow. I imagine you don't want to invoke the function immediately.