Answer the question
In order to leave comments, you need to log in
How to make react + require.js together?
If you google this question, then there is an option where jsx is compiled directly into the browser. However, I want to compile to js via babel and include it using require.js
The following is written in the require.js config:
require.config({
baseUrl: '/js/',
paths: {
react: "libs/react",
ui: " react"
}
});
requirejs(["ui/main"]);
In the jsx file
define(["react"], function(React) {
class Test extends React.Component {
render() {
return (
<div>12312312123123</div>
);
}
};
React.render(
<Test />,
document.getElementById('test')
);
});
Answer the question
In order to leave comments, you need to log in
Judging by the text of the error, somehow the super() method, which is usually called in the constructor
constructor(props) {
super(props); // вот тут получили undefined
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question