Answer the question
In order to leave comments, you need to log in
How to change nested field?
Good afternoon!
There is such a data structure
const data = [
{
"id": 000,
"content": "test0",
"postedAt": 1581515871,
"answers": [
{
"id": 001,
"content": "test1",
"postedAt": 1624960660,
"answers": []
}
]
}
]
postedAt
const filteredFirstMessage = useMemo(
() => ([{
...data,
postedAt: `${format(new Date(data.postedAt * 1000)}`,
}]),
[data],
);
answers
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question