Utilities: Add useExperimentalFlag hook

This commit DRYs out the code, extracting the logic for setting the
value of the experimentalFlag into a new hook found in the utilities.

It also makes the typing stricter - the hook returns a boolean. The
pattern we were using previously to set the value of experimentalFlag
variables could be boolean, string, or undefined.
This commit is contained in:
lucasgarfield 2024-03-05 18:14:27 +01:00 committed by Lucas Garfield
parent baddf66273
commit c73482dd7f
4 changed files with 32 additions and 14 deletions

View file

@ -25,7 +25,7 @@ import { resolveRelPath } from '../../Utilities/path';
import './ImageBuilderHeader.scss';
type ImageBuilderHeaderPropTypes = {
experimentalFlag?: string | true | undefined;
experimentalFlag?: boolean;
};
export const ImageBuilderHeader = ({