Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When javascript is disabled, React event does not work

I am referring to the following example for Node and React: https://github.com/yldio/react-example

I am able to add a book to the array when javascript is enabled in Chrome. When I disable javascript in Chrome, I am not able to add a book to the array.

Is there any way to resolve this?

like image 639
Priya Avatar asked Nov 30 '22 10:11

Priya


1 Answers

Is there any way to resolve this?

Not in the way that you're hoping.

React is a JavaScript framework for the front-end. Which means it executes in the browser. If you disable JavaScript in the browser, React doesn't work anymore. Just in the same way if you delete Photoshop from your computer, you can't open .psd files anymore.

If you really must support browsers without JavaScript (which most people don't), you need to build your app to work with plain old HTML based navigation (think links, forms etc).

It's possible to use React (for people with JS enabled) and a fallback for those without, this approach is called Progressive Enhancement. Might be useful to you: https://softwareengineering.stackexchange.com/questions/25969/should-i-bother-to-develop-for-javascript-disabled

like image 53
Matt Harrison Avatar answered Dec 05 '22 03:12

Matt Harrison