###前提・実現したいこと
serverlessを使ってReactを使いたくて
http://qiita.com/Eiryyy/items/3f16b9ebad51883869e5
この記事どうりにとりあえずやりたい
###発生している問題・エラーメッセージ
ERROR in ./client/src/reducer.js Module not found: Error: Cannot resolve 'file' or 'directory' ./actions in /Users/hoge/serverless-react/client/src @ ./client/src/reducer.js 7:15-35 ERROR in ./client/src/app.jsx Module not found: Error: Cannot resolve 'file' or 'directory' ./actions in /Users/hoge/serverless-react/client/src @ ./client/src/app.jsx 15:15-35
###該当のソースコード
reducer.js
javascript
1import { REQUEST, RECEIVE } from './actions'; 2 3const initialState = { 4 isFetching: false, 5 message: 'This is React App.' 6}; 7export default (state = initialState, action) => { 8 switch (action.type) { 9 case REQUEST: 10 return Object.assign({}, state, { 11 isFetching: true 12 }); 13 case RECEIVE: 14 return Object.assign({}, state, { 15 isFetching: false, 16 message: action.message 17 }); 18 default: 19 return state; 20 } 21};
app.jsx
import React from 'react'; import { connect } from 'react-redux'; import { fetchHello } from './actions'; class App extends React.Component { constructor() { super(); this.onClickHello = this.onClickHello.bind(this); } onClickHello() { this.props.dispatch(fetchHello()); } render() { return ( <div> <h1>{this.props.message}</h1> <button onClick={this.onClickHello}>Hello</button> <div> {this.props.isFetching ? 'Fetching...' : ''} </div> </div> ); } } export default connect((state) => { return { message: state.message, isFetching: state.isFetching }; })(App);
###試したこと
バージョンの問題かと思い、バージョンをnode 4.3.0に合わせてやり直した
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。