Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: navigator is not defined in Nextjs #536

Open
upfounders opened this issue Oct 6, 2023 · 2 comments
Open

ReferenceError: navigator is not defined in Nextjs #536

upfounders opened this issue Oct 6, 2023 · 2 comments

Comments

@upfounders
Copy link

I am creating form with formio in Nextjs project got this error, anyone see this problem, and any workaround?

error - ReferenceError: navigator is not defined
at Object. (/Users/kilghar/Documents/Code/uf-next/node_modules/formiojs/components/file/File.js:120:21)

@enkinduweles
Copy link

I have the same problem, even using the 'use client' directive of nextjs.

@Dalorzo
Copy link

Dalorzo commented Nov 6, 2023

You to load the form dynamically and avoid any SSR, you will get rid of that problem.

import dynamic from 'next/dynamic'

const Form = dynamic<FormioFormProps>(() => import('@formio/react').then(mod => mod.Form), {
  ssr: false,
  loading: () => <p>Loading...</p>,
})

You continue using your form like you usually do

/*your commponent*/
return ( <Form
          formReady={onFormReady}
          options={options} .....
          

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants