I created a sample React app using CRA. Created a simple component (just an h1
element) and built the app for production using npm run build.
When I inspect index.html
inside the /build
folder, it has a line: <noscript>You need to enable JavaScript to run this app.</noscript>
This app doesn’t make any API requests, hence no need for a proxy or anything related. Also, locally works fine.
Did anyone have such problems?
I’ve tried adding proxy in package.json even though the app doesn’t have any API calls.
2
Answers
By default react does client side rendering using javascript to build HTML from your component definition. That is why the warning exists, without javascript enabled in the browser(it is on by default in most cases), the viewer would just get the info why it doesn’t work.
React applications are typically built as single-page applications (SPAs) that heavily rely on JavaScript to render and update the user interface dynamically. If JavaScript is disabled or not supported, the application will not function as expected because React relies on JavaScript to handle component rendering, state management, and interactions.
The tag is used to provide a fallback for users who have disabled JavaScript or are using browsers that do not support it. It displays a message informing users that they need to enable JavaScript to use the application properly.
if JavaScript is disabled, the message inside the tag will be displayed to the user. Otherwise, if JavaScript is enabled, the React application will be loaded and executed, rendering its components