-1

I'm building a multi-step form in React and I would like to console.log the JSON of the props at the end with all the inputted information. How would I do this?

Here is my code:

I tried the deconstructed props in the arrow function component but it didn't work.

const Final = ({
  values: { one, two... }
}) => {

 console.log(JSON.stringify(Final);

I managed to log the info this way, but it's not exactly what I would like:

  console.log(
    "Value One: " + one,
    "Value Two: " + two,
    ....);

I deleted my previous question by accident

janeseym
  • 43
  • 4
  • Possible duplicate of [How can I pretty-print JSON using JavaScript?](https://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript) – Mickey Aug 14 '19 at 02:09

1 Answers1

-1

I would probably just take props as an argument rather than destructuring:

const Final = (props) => {

 console.log(JSON.stringify(props));
Nick
  • 16,066
  • 3
  • 16
  • 32