Create Parameters dynamically from JSON in React

Viewed 15

i'm trying to create Parameters dynamically.

{({ destinations: { question2, question3 } }) => (
              <div className="buttonContainer">
                <button onClick={question2}>Yes</button>
                <button onClick={question3}>No</button>
              </div>
)}

The destionations: { question2, question3 } should be created dynamically from a Json that looks like this:

const data = {
  content: {
    body: [
      {
        nextTag: ["question2", "question3"],
      },
    ],
  },
};

Thanks for help.

0 Answers
Related