D
D
diwlumoprif2020-04-25 15:13:30
React
diwlumoprif, 2020-04-25 15:13:30

How to view the state of the useState hook in the console? And how to see the state of an individual hook property?

There is a state in the hook:

const [value, setValue] = useState({
    list: [],   
    number:1
  });


Then I change it:
const method = () => {    
    setValue(({
      list: response.data,
    });
  };


1) How to see the state of the useState hook in the console?
2) And how to see the state of a particular hook property?

Ie what to enter in both cases in: console.log(......)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robur, 2020-04-25
@diwlumoprif

console.log(value)
console.log(value.list)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question