Trying to run npm dev and unable to locate file context.js
Using this to call the context
import { AccountContext } from '../context.js'
And this is my context.js file
import { createContext } from 'react' export const AccountContext = createContext(null)
Is there an installation I'm missing?
As you are exporting a single context (at the end its a function) per file, you can do default export & import. Like this-
import { createContext } from 'react'
const AccountContext = createContext(null)
export default AccountContext
import it like this-
import AccountContext from '../context.js'
You may want to refer this doc to see best practices of importing and exporting modules.