export const ctx = {
a: 1
}
import React, {Provider} from 'react';
import {ctx} from './context';
const CTX = React.createContext(ctx);
function App() {
return (
<CTX.Provider value={ctx}>
<MyComponent />
</CTX.Provider>
);
}
<CTX.Provider value={ctx}>
<MyComponent />
</CTX.Provider>
const CTX = React.createContext();
const App = () => (
<CTX.Provider value={ctx}>
<MyComponent />
</CTX.Provider>
);
const CTX = React.createContext(ctx);
const App = () => (
<MyComponent />
);