react-props-and-expressions Flashcards
1
Q
What are props in React?
A
“Props” is a special keyword in React, which stands for properties and is being used for passing data from one component to another. But the important part here is that data with props are being passed in a uni-directional flow. ( one way from parent to child)
-https://itnext.io/what-is-props-and-how-to-use-it-in-react-da307f500da0
2
Q
How do you pass props to a component?
A
You can pass any JavaScript expression as a prop, by surrounding it with {}. For example, in this JSX:
< MyComponent foo = { 1 + 2 + 3 + 4 } / >
3
Q
How do you write JavaScript expressions in JSX?
A
Within the curly braces