I am structuring data to be used later to hydrate a table in react, where the data will change dynamically through WebSocket calls. Currently I have an array of objects:
result1
Array(2) [Object, Object]
[[Prototype]]: Array(0)
length: 2
0: Object {name: "pizza", poolsCount: 2, pools: Array(2)}
1: Object {name: "apple", poolsCount: 3, pools: Array(3)}
__proto__: Array(0)
I can convert the arrays to objects using result = Object.assign({}, result1);
:
result
Object {0: Object, 1: Object}
[[Prototype]]: Object
0: Object {name: "pizza", poolsCount: 2, pools: Array(2)}
1: Object {name: "apple", poolsCount: 3, pools: Array(3)}
__proto__: Object
With that data, and once I get the React UI setup, I will want to each pools
object’s properties to be displayed in its own column:
Which is more convenient and recommended for use in my react application?