ReactJS Props Undefined
Props are passed as an argument to function components. You can’t reference this.props
. Access it from the props
argument:
function Product7 (props) {
return (
<h4>{props.name}</h4>
)
}
don't use this
in functional components, <h4>{props.name}</h4>
If you want to use the props in the component, you must define it as a parameter:
function Product7(props) {
...