Props에 관한 퀴즈

Juyeon Lee·2022년 4월 25일
0

REACT 리액트

목록 보기
10/65
  1. What do props help us accomplish?
    props help us render things that have the same format but different content
    Make a component more reusable..

  2. How do you pass a prop into a component?
    you write prop as an argument and then use prop.name for example?

<MyAwesomeHeader title="???" />
  1. Can I pass a custom prop (e.g. blahblahblah={true}) to a native
    DOM element? (e.g.

    ) Why or why not?

    No, because the JSX we use to describe native DOM elements will
    be turned into REAL DOM elements by React. And real DOM elements
    only have the properties/attributes specified in the HTML specification.
    (Which doesn't include properties like blahblahblah)

  1. How do I receive props in a component?
function Navbar() {
    return (
        <header>
            ...
        </header>
    )
}

just simply put props

  1. What data type is props when the component receives it?
    property? An object

0개의 댓글