I am trying to parse string to object array in my React application.
const {newsEntity} = props;
const contentInString = {newsEntity.content}; <== not working
// const contents = JSON.parse(contentInString); <== hoping to use this someday
I got the following error ESLint: Parsing error: ',' expected.
I tried to removed the curly braces but it gives undefined
Content :
[{"content":"Umi Kalsum berharap kondisinya tetap baik","type":"text"},{"content":"Dream - Setelah menempuh perjalanan darat cukup panjang untuk menemui wanita diduga telah menghina keluarganya, Umi Kalsum dan Ayah Rozak akhirnya kembali rumahnya di Depok, Jawa Barat. Perjalanan panjang itu ternyata menguras tenaga orang tua Ayu Ting Ting tersebut.","type":"text"}
The content of {newsEntity}
I notice only visible during the rendering
return (<div> {newsEntity.content}</div> );