Hey, how can i use data.json in App.js. I would like to map this data in App.js, but it must be located in another folder - outside src.
Relative imports outside of src/ are not supported.
Hey, how can i use data.json in App.js. I would like to map this data in App.js, but it must be located in another folder - outside src.
Relative imports outside of src/ are not supported.
Add the json data to a js file and then export it. Then import it from the file and use it.
Sample:
import React from 'react';
export const filterData = [
{
value: 'popularity.desc',
title: 'Popularity Desc'
},
{
value: 'popularity.asc',
title: 'Popularity asc'
},
{
value: 'release_date.desc',
title: 'Release-Date Desc'
},
{
value: 'release_date.asc',
title: 'Release-Date Asc'
},
{
value: 'revenue.desc',
title: 'Revenue Desc'
},
{
value: 'revenue.asc',
title: 'Revenue Asc'
},
{
value: 'original_title.desc',
title: 'Original-Title Desc'
},
{
value: 'original_title.asc',
title: 'Original-Title Asc'
},
{
value: 'vote_average.desc',
title: 'Average-Vote Desc'
},
{
value: 'vote_average.asc',
title: 'Average-Vote Asc'
},
{
value: 'vote_count.desc',
title: 'Average-Count Desc'
},
{
value: 'vote_count.asc',
title: 'Average-Count Asc'
}
]