You should check if props exists, first time it renders the component it has no props so it shows undefined.
First i must say you destructured notecards
out, so no need to use props.
If you want to use props you should change
({notecards})
to (props)
and if not you can directly use notecards
since it is destructured
I suggest you two ways
adding question mark to check if exists
<h1>{props?.notecards} hi</h1>//in the case you want to use props
or
add the props in a if statement
<h1>{props.notecards?props.notecards:''} hi</h1> // if notecards is destructured remove the "props."
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…