Manage your learning questions and answers
Props is data coming from outside of the component (from Parent component) and can only be updated by the parent component. State is internal data from the component logic itself, and it can be updated internally.
No answer yet
No answer yet
A mechanism for passing data from a parent component to a child component, they are read-only (immutable). It's used by creating a property with a given name in the parent component and then we access it from the child component through props in arguments to use it.
{/* Parent component */}
function App() {
return <Greeting name="Alice" />;
}
{/* Child component */}
function Greeting(props) {
return <h1>Hello, {props.name}!</h1>;
}
No answer yet
No answer yet
No answer yet
No answer yet
No answer yet
No answer yet
Imperative is manually selecting DOM elements and traversing the DOM, basically telling the browser how to do things. Declarative is to describe what UI should look like using JSX based on props and state (DOM is completely abstracted)
Declarative syntax to describe what components look like and how they work