jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
33.77k stars 2.78k forks source link

'FieldArray' cannot be used as a JSX component. #3766

Closed yurii-futur closed 1 year ago

yurii-futur commented 1 year ago

Bug report

Current Behavior

'FieldArray' cannot be used as a JSX component.
  Its element type 'ReactElement<any, any> | Component<FieldArrayConfig, any, any> | null' is not a valid JSX element.
    Type 'Component<FieldArrayConfig, any, any>' is not assignable to type 'Element | ElementClass | null'.
      Type 'Component<FieldArrayConfig, any, any>' is not assignable to type 'ElementClass'.
        The types returned by 'render()' are incompatible between these types.

Your environment

Software Version(s)
Formik 2.2.9
React 18.2.0
TypeScript 5.0.4
Browser Chrome
npm/Yarn yarn
Operating System Mac
yurii-futur commented 1 year ago

Solution that worked for me:

# 👇️ with NPM
npm install --save-dev @types/react@latest @types/react-dom@latest

# 👇️ if you also want to update react and react-dom
npm install react@latest react-dom@latest

# ------------------------------

# 👇️ with YARN
yarn add @types/react@latest @types/react-dom@latest --dev

# 👇️ if you also want to update react and react-dom
yarn add react@latest react-dom@latest
Tomekmularczyk commented 1 year ago

still having this issue