剧场模式
首页React & Redux & React-Router & Nodejs 实战 crud 项目

React & Redux & React-Router & Node.js 实战 crud 项目 #1 项目搭建

下载发布于505 次观看
2

这一节很简单,直接按着命令和代码操作就可以。

src/index.js

import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
import { Provider } from 'react-redux';
import registerServiceWorker from './registerServiceWorker';

import { createStore, applyMiddleware } from 'redux';
import rootReducer from './reducers';
import { composeWithDevTools } from 'redux-devtools-extension';
import logger from 'redux-logger';

const store = createStore(
  rootReducer,
  composeWithDevTools(
    applyMiddleware(logger)
  )
);

ReactDOM.render(
  <Provider store={ store }>
    <App />
  </Provider>,
  document.getElementById('root')
);
registerServiceWorker();

src/components/App.js

import React, { Component } from 'react';

class App extends Component {
  render() {
    return (
      <div>
        Home
      </div>
    );
  }
}

export default App;

src/reducers/games.js

const games = (state = [], action = {}) => {
  switch(action.type) {
    default: return state;
  }
}

export default games;

src/reducers/index.js

import { combineReducers } from 'redux';

import games from './games';

export default combineReducers({
  games
});
1 条评论
  • 请问有人有这个pro视频的账号吗 借我用用,可以考虑付一定的费用,联系QQ:1043056891

播放列表目录
扫码打赏 16.8 元起加我微信拉入微信群

加我微信:15014006126

打赏的朋友或 Pro 学员获得特权

  • 加我微信拉你进微信群,享有更多互动和人脉资源;

  • 网站固定数量代金券,用于购买收费课程;

  • 和 10 年程序员老兵我成为微信好友;

  • 不定期技术分享和视频问题解答

友情提示
热门播放列表 love