@openshift-console/dynamic-plugin-sdk
Version:
Provides core APIs, types and utilities used by dynamic plugins at runtime.
10 lines (9 loc) • 471 B
JavaScript
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: FIXME out-of-sync @types/react-redux version as new types cause many build errors
import { useSelector } from 'react-redux';
/**
* Hook that returns the given feature flag from FLAGS redux state.
* @param flag The feature flag to return
* @returns the boolean value of the requested feature flag or undefined
*/
export const useFlag = (flag) => useSelector(({ FLAGS }) => FLAGS.get(flag));