Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use React without nodejs

I have a question about how to use React without Nodejs. I know there is a CDN link that we can use React like a normal script. But what I want is be able to import React like a module (es6) without Nodejs

From React source code I see import statement like this:

import ReactVersion from 'shared/ReactVersion';

But I think it only work with Nodejs, right? Because from what I know, es6 import statement requires to ".js" to be added

Is it possible? Do you have any idea?

Thanks for your help

like image 840
Thelearning Avatar asked Oct 26 '25 03:10

Thelearning


1 Answers

You don't need nodejs to es6 syntax. If you are using es6 syntax then due to compatibility reason you need to transpile to es5. To do that you need some bundler like web pack or parcel. They can transpile your code to es5.

like image 163
Rahul Rana Avatar answered Oct 28 '25 15:10

Rahul Rana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!