reading-note

https://eng-ehabsaleh.github.io/reading-note/

View on GitHub

Form and Controlled Components

Q1 answer

An input form element whose value is controlled by React in this way is called a “controlled component”.

Q2 answer

With a controlled component, the input’s value is always driven by the React state.and Since handleChange runs on every keystroke to update the React state, the displayed value will update as the user types.

Q3 answer

using handleInputChange function as the following syntax handleInputChange(event){const age=event.target.value}as an very simple example

The Conditional Operator

Q1 answer

in some casses we might dont want to show the user in the ui the component unliss he do something like if logged in or if he logged out or if he click a button or lets say i dont want to show a pop-upmessage unliss the user hover over a specific word this is wher we should use the the condetional operatore

syntax for ternery operatore {condition ? true : false}

Q2 Asnwer

{x===y ? (console.log(‘true’) : (console.log(‘false’)