react-custom-roulette
react-custom-roulette copied to clipboard
oe[n] is undefined
Tried to implement it on next, react 18 and react 17 but keeps throwing error oe[n] is undefined.
Could you please provide the code and more information regarding this issue ?
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
U are genious