wingkwong / react-quiz-component

:orange_book: React Quiz Component
https://wingkwong.github.io/react-quiz-component/
MIT License
370 stars 142 forks source link

Next Button onClick handler #231

Open 127 opened 6 months ago

127 commented 6 months ago

Hi, it would be nice to have a next question button click handler in addition! Now it can be done with sth like

  useEffect(() => {
    const handleClick = (event: any) => {
      if (event.target.classList.contains("nextQuestionBtn")) {
        console.log(". nextQuestionBtn pressed");
      }
    };

    document.addEventListener("click", handleClick);
    return () => document.removeEventListener("click", handleClick);
  }, []);