Skip to content

Passing props breaking the code #61

Discussion options

You must be logged in to vote

Hi @lilyntalmers, 👋

you forgot to put props as a MyForm parameter:

const MyForm = (props) => { // 👈 here
  const myForm = useForm();

also, when using it later, you don't need this as you are in a functional component

<Step1
  form={myForm}
  totalPrice={totalPrice}
  myUrl={props.myurl}
/>

You can also destructure props to get only the myurl variable:

// 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 MyUrl and prefer myUrl as camelCase

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lilyntalmers
Comment options

Answer selected by lilyntalmers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants