DEV Community

Discussion on: Hooked-Form v4

Collapse
 
alfredosalzillo profile image
Alfredo Salzillo

There is an error in the first code snippet

const Wrapper = ({ children, name, friends }) => {
  const initialValues = React.useMemo(() => ({
    name: props.name, // <- should be 'name,'
    friends: props.friends, // <- should be 'friends,'
  }, [name, friends]);

  return (
    <HookedForm onSubmit={console.log} initialValues={initialValues}>
      {children}
    </HookedForm>
  )
}
Collapse
 
jovidecroock profile image
Jovi De Croock • Edited

Yes, thank you it should be:

const Wrapper = ({ children, name, friends }) => {
  const initialValues = React.useMemo(() => ({
    name: props.name, // <- should be 'name,'
    friends: props.friends, // <- should be 'friends,'
  }), [name, friends]);

Thank you so much for bringing that to my attention!