react-props-and-expressions Flashcards
1
Q
What are props in React?
A
An object that is passed to a component which has property value pairs associated with the attribute value pairs meant for the React elements within the component.
2
Q
How do you pass props to a component?
A
When a component is defined in a React element, after the tag name attribute value pairs can be defined. Those will automatically be passed to that component in the form of the props object.
3
Q
How do you write JavaScript expressions in JSX?
A
With curly braces. If used to set attribute values for components, don’t wrap in quotes.