reading-notes

Forms

Since form elements naturally hold some internal state, they behave a little differently in React than other DOM elements.

When a user submits a form, the form’s default HTML form action is to navigate to a new tab. It simply functions in React if you like this action. However, in most cases, using a JavaScript feature that manages form entry and has access to the data entered by the user is more convenient. A methodology known as “controlled components” is often used to do this.

The Conditional

Beginning with the Fundamentals — The If Argument When we have a clause, such as an if sentence, we will determine that a certain block of code should be executed if a specific condition is reached.

Instead of longer if and else conditional sentences, use the ternary operator to make decisions. There are three arguments to the ternary operator: The first point is based on a distinction. The product of a true analogy is the second. and to make the coding easier to read.

Normal If Argument

if(x===y){

console.log(true);

} else {

console.log(false); }

Operator Conditional

console.log((x===y)? true : false);