Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
import React from 'react'
import { createContext } from 'react'
import { RatingsProps } from './typings'

const RenderContext = createContext({
  // defaultProps
  shouldShowCount: false,
})

const { Provider, Consumer } = RenderContext

interface RatingContextProps extends RatingsProps {
  shouldShowCount: boolean
}

class RatingContext extends React.Component<RatingContextProps> {
  render() {
    const value = {
      shouldShowCount: this.props.shouldShowCount,
    }
    return <Provider value={value}>{this.props.children}</Provider>
  }
}