Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 989 Bytes

configContext.md

File metadata and controls

37 lines (27 loc) · 989 Bytes

@svg-use/react


@svg-use/react / configContext

Variable: configContext

const configContext: Context<Config>

Defined in: packages/react/src/ThemedExternalSvg.tsx:63

A context that you can use to customise the runtime behavior of ThemedExternalSvg. Because ThemedExternalSvg is usually a compilation target, this allows you to inject configuration without changing the signature of modules.

Example

import { configContext, type Config } from '@svg-use/react';

const config: Config = {
  // Add any config options here
  rewritePath: (pathOrHref) => pathOrHref,
  runtimeChecksEnabled: process.env.NODE_ENV !== 'production',
};

const AppRoot = () => {
  return (
    <configContext.Provider value={config}>
      {/* The rest of the application */}
    </configContext.Provider>
  );
};