DEV Community

Discussion on: How to use the new React context API - tutorial & screencast

Collapse
 
syamjayaraj profile image
Syamlal CM • Edited

The same issue occurred for me. But I found the solution also.

Create a file AppContext.js separately.

//AppContext.js
import React from "react";
const AppContext = React.createContext();
export default AppContext;

Now import this file where AppContext is required.