@react-ui-org/react-ui
Version:
React UI is a themeable UI library for React apps.
11 lines (9 loc) • 316 B
JavaScript
export const resolveContextOrProp = (contextValue, propValue) => {
// We need to test:
// * `false` - for when the `contextValue` is boolean
// * `null` - for when the `contextValue` is non-boolean
if (contextValue === false || contextValue === null) {
return propValue;
}
return contextValue;
};