Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

React FormiumForm without defaultComponents throws error#67

Copy link
Copy link
@loicnestler

Description

@loicnestler
Issue body actions

馃悰 Bug report

Current Behavior

I'm using Next.js@11.0.1 with React@17.0.2.
This is my pages/index.tsx:

const Home = ({ form }: { form: Form }) => {
// ...
  return (
      {/* ... */}
      <FormiumForm
          //components={defaultComponents}
          data={form}
          onSubmit={async (values) => {
             await formium.submitForm("your_form_slug", values)
             console.log("submit", values)
          }}
       />
      {/* ... */}
    )
}

export default Home

export const getStaticProps: GetStaticProps = async () => {
   const form = await formium.getFormBySlug("<form-slug>")
   return { props: { form } }
}

No matter if I provide defaultComponents as components prop or not, Next will throw this error:

Error: Objects are not valid as a React child (found: object with keys {}). If you meant to render a collection of children, use an array instead.

image

When i console.log formium's defaultComponents, this get's logged:

{
  SubmitButton: [Function: SubmitButton],
  NextButton: [Function: NextButton],
  PreviousButton: [Function: NextButton],
  Header: [Function: Header],
  ElementsWrapper: [Function: ElementsWrapper],
  PageWrapper: [Function: PageWrapper],
  FooterWrapper: [Function: FooterWrapper],
  FieldWrapper: [Function: FieldWrapper],
  FormControl: {
    '$$typeof': Symbol(react.memo),
    type: [Function: FormControl],
    compare: null
  },
  TextInput: {
    '$$typeof': Symbol(react.memo),
    type: [Function: TextInput],
    compare: null
  },
  Textarea: {
    '$$typeof': Symbol(react.memo),
    type: [Function: Textarea],
    compare: null
  },
  Radio: {
    '$$typeof': Symbol(react.memo),
    type: [Function: Radio],
    compare: null
  },
  Checkbox: {
    '$$typeof': Symbol(react.memo),
    type: [Function: Checkbox],
    compare: null
  }
}

Looks right to me?

Same error when using the example from https://formium.io/docs/react/typescript.

Your environment

Software Version(s)
Formium 0.1.3
React 17.0.2
TypeScript 4.3.5
npm/Yarn yarn@1.22.1
Operating System MacOS
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.