2
我的工作在網站上,並試圖包括ReactJS成分,我做它像這樣:實施ReactJS成角應用
import React from "react";
import ReactDOM from "react-dom";
import Layout from "Layout.jsx";
const app = angular.module('myApp');
const reactDirective = app.directive('reactDirective', function() {
return {
template: '<div id="reactapp"></div>',
link: function(scope, el, attrs){
ReactDOM.render(<Layout/>, document.getElementById('reactapp'));
}
}
});
和Layout.jsx
import React from 'react';
export default class Layout extends React.Component {
constructor(props){
super(props);
}
render() {
return (
<div>
This is ReactJS
</div>
);
}
}
然而每當它編譯,它給我
ERROR in ./react-app.js Module not found: Error: Cannot resolve module 'layout.jsx'
任何人都可以告訴我什麼是我的代碼錯了嗎?
啊對了,哎呀,我完全忘了 – SirSoDerp