Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View the source code of a website built with React

Tags:

reactjs

Is there anyway to view the react source code of websites built with React?

If you inspect the source code of a react page you will only see the root div. Is there a way to see the actual components?

like image 273
JohnSnow Avatar asked May 27 '17 04:05

JohnSnow


People also ask

How do I see source code in React?

Its source code is located in packages/react-dom/src/events .

Can you see the React code for a website?

Do you know that when you deploy your React application which is created using create-react-app or your own webpack configuration to a live website like Netlify, Vercel, Heroku etc, your entire source code is visible to everyone from the sources tab of the dev tools.


2 Answers

You can use React Developer Tools browser extension. This will allow you to see the Component Tree of any React application. Also, you can inspect props and state of each component with it. But still, you won't be able to see the source code of Component after a production build.

like image 158
Tharaka Wijebandara Avatar answered Sep 18 '22 18:09

Tharaka Wijebandara


There are 2 tools which might help .
One is already mentioned in the answer by @tharaka
The other tool is Redux Dev Tools for state management .

like image 38
Yash Sharma Avatar answered Sep 18 '22 18:09

Yash Sharma