i had an this error below in the browser when working on a react project, it says failed to compile and the data i was parsing in the Api context is below below in from the browser.how can i get rid of this error ./src/data.js Line 4:14: Parsing error: Legacy octal literals are not allowed in strict mode
2 | id:1,
3 | title:"Google Pixel - Black",
> 4 | img:"img\1595035611130_elaine-casap-qgHGDbbSNm8-unsplash.jpg",
| ^
5 | price:10,
6 | company:Google,
7 | info:"Lorem, ipsum dolor sit amet consectetur adipisicing elit. Debitis eum obcaecati dignissimos dolorem ex quos a sit repudiandae cumque exercitationem officia assumenda, fugit non corrupti, itaque vel doloremque eligendi quis?",
The issue is in img
name. You have to escape
octal literals inside a string.
Change that to:
img:"img\\1595035611130_elaine-casap-qgHGDbbSNm8-unsplash.jpg",