react-custom-roulette icon indicating copy to clipboard operation
react-custom-roulette copied to clipboard

oe[n] is undefined

Open Cerrebe opened this issue 2 years ago • 3 comments

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

Cerrebe avatar Apr 05 '23 03:04 Cerrebe

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

Acarvajal904 avatar Apr 11 '23 13:04 Acarvajal904

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: https://github.com/effectussoftware/react-custom-roulette/issues/57

DazKins avatar Apr 16 '23 06:04 DazKins

U are genious

Gabriel-Passoss avatar Aug 06 '23 18:08 Gabriel-Passoss