Home > Back-end >  React Bootstrap - Adding logic to a button
React Bootstrap - Adding logic to a button

Time:09-21

I am trying to add logic to my Project's button - this is the logic :

<Button>
<input variant="primary" type="submit" value={editMode ? "Update Recipe" : "Create Recipe" }>

</input>
</Button>

So far I couldn't find a way to implement it.. so I ended up with an input inside of my button - which. looks very much weird. Could someone give me an insight?

here is what it looks like Thanks :)

CodePudding user response:

Based on this documentation, to implement a submit button in a form you can try this:

<Button variant="primary" type="submit">
    {editMode ? "Update Recipe" : "Create Recipe" }
</Button>

Instead of putting an input field inside of a button, you can actually use the button as an input instead.

  • Related