Comments (4)
Yes @brendanbond the approach you suggested is the typical way to handle Client Side Rendering (CSR) in the next.js. I implemented that solution in my project but it didn't work for me.
This is another approach I found:
import dynamic from 'next/dynamic' const Form = dynamic(() => import('@formio/react').then(module => module.Form), { ssr: false })
Now you can use the Form object as you need
from react.
I have a basic setup of the app recommended in the documentation and facing a similar issue while building the NextJs React app.
Build error occurred
ReferenceError: window is not defined
at Object. (/app/node_modules/formiojs/providers/storage/s3.js:54:23)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Module.require (node:internal/modules/cjs/loader:1100:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object. (/app/node_modules/formiojs/providers/storage/index.js:9:33)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10) {
type: 'ReferenceError'
from react.
Hey guys @viralP1 @Matthew-owo I am currently working on this issue, but please help me understand something: does this issue get resolved with a regular old check for window
? In other words, because Form.io is currently a client-side rendering engine, if you change your component to something like this:
const Page = () => {
return (
<>
typeof window === 'undefined' ? null : <Form src="https://examples.form.io/example" />
</>
);
};
does it work? Or does it still not like the actual imports of Form.io? FWIW I believe this is the recommended approach for client components with client-side-only code.
from react.
Related Issues (20)
- defaultProps deprecation warning HOT 5
- Text Input Components is Not Supported Within Dialog Component Wrappers of bootstrap or material HOT 1
- Collapse does not work HOT 3
- Tailwind CSS integration with formio/react HOT 3
- <Form /> has runtime errors when `noDefault` is `true` HOT 1
- `readOnly` option change doesn't re-render the <Form /> editability status HOT 2
- How can I make reference to <Form /> from external javascript code ? HOT 1
- ReferenceError: navigator is not defined in Nextjs HOT 2
- importScript Error while Drag and Drap New Text field HOT 7
- Bug: Component Style Not Applied Correctly
- adding custom component to formio . HOT 1
- React is null in @formio/react src/components HOT 1
- [BUG] Warning for Custom Components above React version 18 HOT 1
- Plugins don't support asynchronous functions HOT 4
- I am using FormBuilder in the react functional base component and am not able to re-render Formio Builder on state change.
- Using an external button and Hebrew name in API HOT 4
- Formio Builder configuration with accessibility HOT 3
- Address field does not pre-fill when passing data into submission object HOT 3
- Drop babel-polyfill
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.