useReactBricksContext
const useReactBricksContext = (): types.IReactBricksContext
Hook with no arguments to access the values in ReactBricksContext. It returns an object. The values in the returned object are from the configuration you provided to the ReactBricks component, so you should have them available in your project, but this hook could be useful to access them from any component wrapped by ReactBricks, for example a content block.
Example usage
const { bricks } = useReactBricksContext()
ReactBricksContext
The ReactBricksContext
provides configuration context to all the children components.
It has the following TypeScript interface:
interface IReactBricksContext { appId: string apiKey: string bricks: Bricks pageTypes: IPageType[] logo: string contentClassName: string renderLocalLink: RenderLocalLink navigate: (path: string) => void loginPath: string editorPath: string playgroundPath: string appSettingsPath: string isDarkColorMode?: boolean toggleColorMode?: () => void useCssInJs?: boolean clickToEditSide?: ClickToEditSide customFields?: Array<ISideEditPropPage | ISideGroup> responsiveBreakpoints: ResponsiveBreakpoint[] enableAutoSave: boolean disableSaveIfInvalidProps: boolean}
The <ReactBricks>
component wraps all the children with the ReactBricksContext Provider.