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

Using <Controls.Canvas> is returning error #52

Open
Theonlyhamstertoh opened this issue Jun 22, 2021 · 2 comments
Open

Using <Controls.Canvas> is returning error #52

Theonlyhamstertoh opened this issue Jun 22, 2021 · 2 comments

Comments

@Theonlyhamstertoh
Copy link

Theonlyhamstertoh commented Jun 22, 2021

After installing with yarn add react-three-gui, I attempted to add it to my scene like this:

import { Controls, useControls } from "react-three-gui";

function App() {
  return (
    <Controls.Provider>
      <Controls.Canvas ></Controls.Canvas>
      <Controls />
    </Controls.Provider>
  );
}

When I write Controls.Canvas, it returns:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `Context.Consumer`.
    at createFiberFromTypeAndProps (react-dom.development.js:25058)
    at createFiberFromElement (react-dom.development.js:25086)
   ...
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Where am I getting this wrong?

@Buraisx
Copy link

Buraisx commented Jul 4, 2021

I've been getting the same error as well. i'm currently working around it by using the withControls example with my own canvas

import { withControls } from 'react-three-gui';

// Wrap the <Canvas> with `withControls`
const YourCanvas = withControls(Canvas);

const Scene = () => (
  <YourCanvas>
    <mesh rotation-x={rotationX} />
  </YourCanvas>
);

@Theonlyhamstertoh
Copy link
Author

I switched to using Leva. If you haven't check it out, it has a great GUI made specifically for react @Buraisx

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

2 participants