HACKER Q&A
📣 simonvall

How do you debug React websites?


How do you do it? I find it to be a very frustrating experience.

- The stack trace in the debugger most of the time gives no useful information.

- Stepping in the debugger rarely gives any errors (except for basic JavaScript errors) and the React errors appears afterwards in the console.

- Setting breakpoints at and stepping into JSX components rarely works.

- Sometimes you get the "Rendered fewer hooks than expected"-thing and the message gives absolutely no useful information at all and the line mentioned in the message is often completely wrong.

Am I missing something? The current strategy is just to stare at the code and print lots of information to the console.


  👤 jollyllama Accepted Answer ✓
Have you tried the "React Developer Tools" Chrome extension? If you get it set up right, it should let you view the state/datastore.