Open laukaichung opened 8 years ago
no reply from author of this tool? have you solved?
It seems like a human error.
Did you realize that you haven't export it?
class ItemPage extends React.Component {
render(){
return <div>{this.props.value}</div>
}
}
should be this?
class ItemPage extends React.Component {
render(){
return <div>{this.props.value}</div>
}
}
export default ItemPage
Anyway, it's a repository for php plugin that processes Javascript syntax (and it seems like it's getting rotten :stuck_out_tongue:). And anyway, try to ask on Stackoverflow first so you'll get answered more quickly, if you think it's a bug, feel free to create an issue.
If you are using Rails, then possible cause of error is that you added
//= require react //= require react_ujs //= require components
into your app/assets/javascripts/application.js
you are missing the Component. i have the same problem but what i did is i declare it on here.
import React, {Component} from 'react'; hope it helps
How can I use Browserify or webpack to compile a es6 script that works with reach-php-v8js? I have tried the following but it looks like the js string produced by
$rjs->getJS("app", "GLOB");
fails to access the component ItemPage inbuild.js
which isn't in the global scope.ReactDOM.render(React.createElement(ItemPage, {"value":"something"}), app);
item_page.js
After transpiling the es6 code into es5 with browserify, build.js by this command,
it ends up like this
Error in Chrome:
Html output