Typing Props
Document props with TypeScript or PropTypes.
Example
import PropTypes from "prop-types";
function Tag({ label }) {
return <span>{label}</span>;
}
Tag.propTypes = { label: PropTypes.string.isRequired };Exercise
Mark required.
PropTypes.string.Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.