This topic is important to me because I want to understand the concept of having user inputs be used on my site, and also managing state iwth that.
https://reactjs.org/docs/forms.html.
https://codeburst.io/javascript-the-conditional-ternary-operator-explained-cac7218beeff.
https://react-bootstrap.github.io/forms/overview/.
https://reactjs.org/docs/conditional-rendering.html.
Imperative Programming is how you implement interaction. You have to command each element.
Using react you don’t directly manipulate the UI.
You declare what you want to show, and React figures out how to update the UI.
To make a form in React, its different. We have to take in different things into consideration. State allows us to have a form of in memory.
You can trigger state updates in response to two kinds of inputs:
Human inputs.
Computer inputs (network response arriving, timeout, image loading)
Using State variables to update the UI.
You need to start with the states that are definitely needed, and then create the others.
Ex. A state that takes in an answer, and also a state that has an error.
Event Handlers will usually take in a a user input.
The Ternary operator lets us shorten our if statements into one line of code.
Like an if statement, the conditional ternary is just a shorthand version of it.
The ? serpates our conditonal form from our true value, anything between the ? and the : is what is executed if the condition evaluates to true.
The : is the else for the program.
condition ? value if true : value if false
1. Why would we use a ternary operator?
2. Rewrite the following statement using a ternary statement:
if(x===y){
console.log(true);
} else {
console.log(false);
}
We would use a ternary operator to help shorten your if statements into a more clean and precise code.
2. x === y ? console.log(true) : console.log(false)
I want to know more about applying states in a deeper user input area. I want to know how complex it can get.