React Flashcards
1
Q
how do you access child elements of a compenent with props?
A
you access the children object in props. you dont need to pass this explicitly because in react children of a component are passed with props automatically.
2
Q
How should you refer to images in a react application
A
instead of static paths inside of a src attribute you should use an import at the top and save the path as a variuable so that the images are not lost in the build process.
3
Q
What is a better way to add these props:
<Element prop1={somthing} prop2={somthing} prop3={something}/>
A
props={ prop1: somthing, prop2: something, prop3: somthing}
<Element {…props}