Sto utilizzando le rotaie e sto cercando di scrivere alcuni componenti in ES6 che assomigliano a questo.Rails-React non funziona con ES6
mio link_list.js.jsx file di
import Component from 'react';
import Links from 'link';
class LinkList extends React.component{
constructor(props){
super(props);
this.sate = {};
}
getInitialState(){
return { links: this.props.initialLinks}
}
render(){
var links = this.state.links.map(function(link){
return <Links key={link.id} link={link} />
})
return (
<div className="links">
{links}
</div>
)
}
}
continuo a ricevere questo Uncaught ReferenceError: require is not defined
e un errore che dice Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).
e l'errore Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
questo è un problema con il mio codice o è un problema con la gemma non compilare ES6 giusto?
Credo che dovrei RTFM più haha: P grazie questo è stato perfetto –