score:2

Accepted answer
import React,{ Component } from 'react';
import { MyContextConsumer } from './index'

class Roots extends Component{
  render(){
    return(
      <MyContextConsumer>
        {value => <p>{console.log(value)}</p>}
      </MyContextConsumer>
    )
  }
}

score:1

export let MyContext=createContext();
export const MyContextConsumer = MyContext.Consumer

Related Query

More Query from same tag