i'm very new in react and i want to use the if-else statement in the jsx to change the behavior of my template. With this code the buttons are rendering in fine, but the onClick, or the link doesn't work. I don't know why.
Currently, the initial state of selected is false, so the addStuff is rendering and work ok, but when i select one elements of the grid, the edit and delete buttons are rendering ok but onClick or link do nothing
{this.state.selected ?(
<div>
<Link to="/updateStuff" ><EditFloatButton /></Link>
<DeleteFloatButton onClick={this.handleOpenDeletePopUp} />
</div>
)
:
<Link to="/addStuff"><AddFloatButton /></Link>
}
I really don't know if this way is the better solution. if you have a better way or a best practice to do this please share it.
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire