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

oe[n] is undefined #119

Open
Cerrebe opened this issue Apr 5, 2023 · 3 comments
Open

oe[n] is undefined #119

Cerrebe opened this issue Apr 5, 2023 · 3 comments

Comments

@Cerrebe
Copy link

Cerrebe commented Apr 5, 2023

Tried to implement it on next, react 18 and react 17 but keeps throwing error oe[n] is undefined.

@Acarvajal904
Copy link
Collaborator

Could you please provide the code and more information regarding this issue ?

@DazKins
Copy link

DazKins commented Apr 16, 2023

I'm seeing the same issue. Using:

  • NextJS v13.1.6
  • React v18.2.0
  • This package v1.4.0

Here's my code:

export default () => {
  const Wheel = dynamic(
    () => import("react-custom-roulette").then((mod) => mod.Wheel),
    { ssr: false }
  );

  const data = [
    { option: '0' },
    { option: '1' },
    { option: '2' },
  ]

  const [mustSpin, setMustSpin] = useState(false);
  const [prizeNumber, setPrizeNumber] = useState(0);

  const handleSpinClick = () => {
    if (!mustSpin) {
      const newPrizeNumber = Math.floor(Math.random() * data.length);
      setPrizeNumber(newPrizeNumber);
      setMustSpin(true);
    }
  }

  return (
    <>
      <Wheel
        mustStartSpinning={mustSpin}
        prizeNumber={prizeNumber}
        data={data}
        onStopSpinning={() => {
          setMustSpin(false);
        }}
      />
      <button onClick={handleSpinClick}>SPIN</button>
    </>
  );
};

Using the hack required to get this working with NextJS: #57

@Gabriel-Passoss
Copy link

U are genious

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

4 participants