Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
Module not Found: Can't resolve Context

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!