Giter Site home page Giter Site logo

Comments (3)

zidoshare avatar zidoshare commented on August 24, 2024

我这样做,只能拿到actions,拿不到state映射过来的属性,不知道在哪里拿。。。

from react-starter-kit.

bodyno avatar bodyno commented on August 24, 2024

贴上我的部分代码,看了你应该就懂了
core/reducer.js

import { combineReducers } from 'redux'
import { routerReducer as router } from 'react-router-redux'
import core from 'reducer/core'
import code from 'components/SendCode/modules/sendCode'
import address from 'components/Address/modules/address'

export const reducers = (asyncReducers) => {
  return combineReducers({
    code,
    core,
    address,
    router,
    ...asyncReducers
  })
}

export const injectReducer = (store, { key, reducer }) => {
  if (Object.hasOwnProperty.call(store.asyncReducers, key)) return
  store.asyncReducers[key] = reducer
  store.replaceReducer(reducers(store.asyncReducers))
}

export default reducers

container.js

import {connect} from 'react-redux'
import {logout} from 'reducer/core'
import {dataChange, upload, uploadMulti, deleteStoreImage, checkDomain, submit, lookImg} from '../modules/apply'
import {codeDataChange, sendCode} from 'components/SendCode/modules/sendCode'
import {putCurAddress} from 'components/Address/modules/address'
import ApplyView from '../components/Apply'

const mapActionCreators = {
  logout,
  dataChange,
  upload,
  uploadMulti,
  deleteStoreImage,
  checkDomain,
  submit,
  lookImg,
  codeDataChange,
  sendCode,
  putCurAddress
}

const mapStateToProps = (state) => ({
  apply: state.apply,
  address: state.address,
  core: state.core,
  code: state.code
})

export default connect(mapStateToProps, mapActionCreators)(ApplyView)

from react-starter-kit.

zidoshare avatar zidoshare commented on August 24, 2024

哦哦,好像有点懂了,我理解实在是有点不足

from react-starter-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.