I have multiple json dataset in js file & datasets length is too much due to this js file code is not looking good. I want to add all json datasets into seperate json file & import datasets one by one in js
const teamMembers = [
{ name: 'Steve Camb', city: 'LA' },
{ name: 'Rich Marson', city: 'CA' },
]
const helpers = [
{ name: 'Jarry lawson', city: 'NW' },
{ name: 'Randy Watt', city: 'HS' },
]
const employeeType = [
{ label: 'Full Time', value: 'Full-Time' },
{ label: 'Part Time', value: 'Part-Time' },
{ label: 'Contractor', value: 'Contractor' },
]
I want to add all this 1 common json file & import it into js file
I tried to do so
// myData.json
const teamMembers = [ //my json data here ]
const helpers = [ //my json data here]
const employeeType = [ //my json data here]
export default { teamMembers , helpers, employeeType }
import { teamMembers , helpers, employeeType } from '../myData.json'
Its not working for me, it gives below error
Expected a JSON object, array or literal.json
Can anyone help me here?
1