Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combineReducers 失效了? #1

Open
hemingming opened this issue May 15, 2018 · 2 comments
Open

combineReducers 失效了? #1

hemingming opened this issue May 15, 2018 · 2 comments

Comments

@hemingming
Copy link

hemingming commented May 15, 2018

可以使用 prop-types?
如何拆分成 components,actions,containers,reducers  的结构,然后使用 combineReducers 没有效果?
eg:

import React from 'react'
import PropTypes from 'prop-types'

const Counters = ({count, onIncrement, onDecrement}) => (
    <div>
        <h2>Redux Counter</h2>
        <button onClick = {onDecrement}> - </button>
        <span>{count}</span>
        <button onClick = {onIncrement}> + </button>
    </div>
)

Counters.propTypes = {
    onIncrement: PropTypes.func.isRequired,
    onDecrement: PropTypes.func.isRequired,
    count: PropTypes.number.isRequired
}
export default Counters
@hemingming
Copy link
Author

I modified it:
https://github.com/hemingming/redux-counter

@anjayluh
Copy link

anjayluh commented Mar 3, 2020

Hi, I followed up to the end and it was exciting. However I got lost on the step of combining the reducers. I combined count and products but the state doesn't update count anymore. Could you take a look at my code and help me out. Here is the repository:
https://github.com/anjayluh/react-redux @dceddia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants