dimanche 31 mai 2020

Conditional rendering for functions

In react I am trying to tell the program to run only if the type is "text" and onSubmit() is ran(This happens when the button is clicked).

type === "checkbox" ? 
setTodos(updatedCheckbox) 
: 
type === "text" && onSubmit() ? 
setTodos(updatedText) 
:  
console.log("!"); 

Aucun commentaire:

Enregistrer un commentaire