score:1

import React, {useState} from 'react';
import QuestionModal from './QuestionModal'

const SomeComponent = (props) => {
  const [showModal, setShowModal] = useState(false);

  const toggleModal = () => {
    setShowModal(!showModal);
  }

  const yesActionLogic = () => {
    // Your yes-action logic...
  }

  return (
    <div>
      {showModal ? (
        <QuestionModal
          title="Sample title",
          questionText="Question?"
          onYesAction={yesActionLogic}
        />
      ) : null}

      <Button onClick={toggleModal}>Toggle Modal</Button>

      {/* The rest of your stuff... */}
    </div>
  );
}

Related Query

More Query from same tag