Define State object #reducChat
Messages object in React Redux Chat Application
by bhupendra negi
JavaScript
const messages = {
user1: {
0: {
msg: "Hi this is user1",
isUserMsg: false
},
1: {
msg: "Hello user1 how are you !",
isUserMsg: true
},
2: {
msg: "Good , you say !",
isUserMsg: false
}
},
user2: {
0: {
msg: "Hallo , this is user2",
isUserMsg: false
},
1: {
msg: "Hello use2, what's going on !",
isUserMsg: true
},
2: {
msg: "Fogg chal rha !",
isUserMsg: false
}
}
}
_.map(messages, (umsg,key) => {
console.group( `Chat history with : ${key}`);
// loop over messages to get char histtory with any single user
_.map(umsg, user => console.log(user.msg) );
console.groupEnd( `Chat history with : ${key}`);
})