Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 4x 4x 4x 4x | /*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React, { useMemo } from "react";
import type { EC3ConfigProps } from "./EC3/EC3Config";
import { EC3Config } from "./EC3/EC3Config";
import { ApiContext, createApiContext } from "./context/APIContext";
/**
* EC3 Context props
* @beta
*/
export type EC3ContextProps = EC3ConfigProps & {
children?: React.ReactNode;
};
/**
* EC3 Context required for EC3 components
* @beta
*/
export const EC3Context = (props: EC3ContextProps) => {
const apiConfig = useMemo(() => {
const ec3Config = new EC3Config(props);
return {
...createApiContext(ec3Config),
config: ec3Config,
};
}, [props]);
return <ApiContext.Provider value={apiConfig}>{props.children}</ApiContext.Provider>;
};
|