I have an array like below:
const data = [
{"id":"1", "sender":"user1", "receiver":"user2", "msg":"hello!"},
{"id":"2", "sender":"user2", "receiver":"user1", "msg":"yo!"},
{"id":"3", "sender":"user3", "receiver":"user1", "msg":"hi!!"},
{"id":"4", "sender":"user1", "receiver":"user3", "msg":"hmm"},
...
]
What I want to do is this. Suppose, I only want to see the conversation between user1 and user 2.
So I want to filter the array and make a new array which will contain only those data where sender is user1 and receiver is user2 or sender is user2 and receiver is user1.
I think, it can be done using map or stuff like that but I actually have no idea. I am new to React Native.