Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Your question has nothing to do with React itself. The question is rather about the types of modules and how to use them. By reference, you include a UMD module, and React will be available as a global React or window.React object. You can work with such a module even from the script tag in the html file:
<script crossorigin src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script>
<script>
function Greetings(props) {
return React.createElement('div', null, 'Hello, World!');
}
</script>
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react.production.min.js');
} else {
module.exports = require('./cjs/react.development.js');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question