PropTypes 작동 원리
PropTypes 작동 원리
import { StrictMode } from "react";
import ReactDOM from "react-dom";
function App(props) {
const { x, y } = props;
return (
<div className="App">
<h1>PropTypes 작동 원리 {x}</h1>
<h2>{y ? "PropTypes는 네임스페이스 객체" : null}</h2>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(
<StrictMode>
<App x="10" y="true" />
</StrictMode>,
rootElement
);

유틸리티 함수
네임 스페이스 만들기
참고
Last updated