armindocachada / gatsby-p5js

BSD Zero Clause License
0 stars 0 forks source link

`react-p5-wrapper` now named import #1

Open fcisio opened 2 years ago

fcisio commented 2 years ago

Hi, I landed here from a Medium article. It took me a little bit to figure out what wasn't working.

react-p5-wrapper is not a default export anymore, so this is how it should be loaded.

import loadable from '@loadable/component'

export const ReactP5Wrapper = loadable(() => import('react-p5-wrapper'), {
  resolveComponent: (components) => components.ReactP5Wrapper,
  ssr: false,
})
owochel commented 2 years ago

I'm getting this error after using this for loadable.js

Error in function createFiberFromTypeAndProps in ./node_modules/react-dom/cjs/react-dom.development.js:28389

with this bug report:

28387 | } 28388 | 28389 | throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); 28390 | } 28391 | } 28392 | }

Any idea?


It worked. Need to change the const name also to p5.js file!