L
L
Lite_robot2017-01-23 21:41:14
JavaScript
Lite_robot, 2017-01-23 21:41:14

React.js: What's the difference between an Object State and an Array State?

Hello, I'm learning React.js and I've encountered difficulties in displaying data from state: when updating a state with type Object, the changes are not reflected in the view. But if you update the state with the Array type, then the updated data is displayed in the view.
state code with Object type:
pastebin.com/sDJJhTrS
state code with Array type:
pastebin.com/bMyFMc6w
In both cases, there is data in the state. Tell me what is the difference and how to fix the code so that the state with the Object type updates the view?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aves, 2017-01-23
@Lite_robot

Need Object.assign({}, state, {messages:action._data, loading:false})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question