0
私はリアクションには新しく、おそらくここで何か間違っていますが、ajaxリクエストを行うときは$が未定義です。ここで私はからの要求を作っていたクラスです:
import React from 'react';
import './Projects.scss';
import Link from '../Link';
import Overlay from '../Overlay';
var Project = React.createClass({
// Project detail class, commented out because it is big.
});
var Projects = React.createClass({
getInitialState: function() {
return { data: [] };
},
componentDidMount: function() {
$.get('http://localhost:3000/api/posts').done(function(data) {
this.setState({data: data});
}.bind(this));
},
render: function() {
return (
<div>
<Project data={this.state.data} />
</div>
);
}
});
export default Projects;
は、戻っています: キャッチされないにReferenceError(約束に):$がcomponentDidMount()から定義されていない
はい、そうです。コンソールに$を入力すると、それは私を捨てました。ありがとう – user1572796