Skip to content

Fix bad react/redux code. #1

@jbhatab

Description

@jbhatab

Tips from Omnidan

don't use constructors in react components
this whole block should be part of action creators and called in a container (smart component)
https://github.com/jbhatab/pulse/blob/master/src/components/Chat.js#L6-L42
https://github.com/jbhatab/pulse/blob/master/src/components/Chat.js#L50 - this should also call an action creator
you're modifying the state directly here (very bad): https://github.com/jbhatab/pulse/blob/master/src/reducers/messages.js#L11
a better way to handle this would be doing state = [] and then return [ ...state, action.message ];
here you're putting it into messages already anyway: https://github.com/jbhatab/pulse/blob/master/src/reducers/index.js

pulse-tips

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions