How to use Context API to pass down a state while using a Router in React JS
问题 I have a Context API file setup which has a state and a function which fetches data from an API and sets the state, and i want to pass the state down to my other components. In my App.js, I am using React-Router to specify the routes. How do i pass the state down to these components using Context API, whilst using React-Router. My ApiContext.js file looks like this : import React, {useState, createContext } from 'react'; export const ApiContext = createContext(); export const ApiProvider =