React page is not showing when there is an error, is there any method that we can use to see the actual error.
trying to built a simple game on the base of react. that work like lottery ticket
import { getTicket, sum } from "./helper";
import "./Lottery.css";
import { useState, useEffect, useRef } from "react";
import party from "party-js";
export default function Lottery() {
let [ticket, setTicket] = useState(getTicket(3));
let isWining = sum(ticket);
const winnerRef = useRef(null);
useEffect(() => {
if (isWining === 15) {
party.confetti(winnerRef.current, {
count: party.variation.range(60, 90),
});
}
}, [isWining]);
let newTicket = () => {
setTicket(getTicket(3));
}
return (
<div>
<div>
<h1>This is a lottery game</h1>
</div>
<div className="Ticket">
<span>{ticket[0]}</span>
<span>{ticket[1]}</span>
<span>{ticket[2]}</span>
</div>
{isWining === 15 ?
<p ref={winnerRef}>Winner</p> :
<p>Loser</p>}
<div>
<button onClick={newTicket}>Buy New Ticket</button>
</div>
</div>
)
}
this is my code but not worked