Repository URL to install this package:
|
Version:
0.14.1 ▾
|
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>
}
}