Passing props breaking the code #61
-
I have a prop( I strongly believe I have done something wrong but can't figure out what😅. Would really appreciate if somebody could take a look. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @lilyntalmers, 👋 you forgot to put const MyForm = (props) => { // 👈 here
const myForm = useForm(); also, when using it later, you don't need <Step1
form={myForm}
totalPrice={totalPrice}
myUrl={props.myurl}
/> You can also destructure props to get only the // at the beginning of the component
const { myurl } = props;
// ...
// and then, later on in the return
<Step1
form={myForm}
totalPrice={totalPrice}
myUrl={myurl}
/> or directly in the component parameter const MyForm = ({ myurl }) => { // 👈 here
const myForm = useForm(); Quick note: avoid the prop I hope I helped, please let me know if it is working for you. |
Beta Was this translation helpful? Give feedback.
Hi @lilyntalmers, 👋
you forgot to put
props
as aMyForm
parameter:also, when using it later, you don't need
this
as you are in a functional componentYou can also destructure props to get only the
myurl
variable:or directly in the component parameter
Quick note: avoid the prop
MyUrl
and prefermyUrl
as camelCase…