Does React Native use require
or import
?
All I can find is an old tutorial using require()
, but when I run react-native
React Native now uses Babel for "modules" compilation (doc). If scaffold an app with create-react-native-app
, in folder node_modules
, there is the Babel plugin named
babel-plugin-transform-es2015-modules-commonjs
, which is referenced across the app.
As name implies, this plugin just transforms ES2015 modules syntax to CommonJS.
For the main differences, I like this answer appearing in another post.