• Version 2.3.0
  • Published
  • 84.9 kB
  • 2 dependencies
  • MIT license


npm i react-inlinesvg
yarn add react-inlinesvg
pnpm add react-inlinesvg


An SVG loader for React



variable cacheStore

const cacheStore: { [key: string]: StorageItem };


    class InlineSVG

    class InlineSVG extends React.PureComponent<Props, State> {}


      constructor(props: Props);

        property defaultProps

        static defaultProps: { cacheRequests: boolean; uniquifyIDs: boolean };

          method componentDidMount

          componentDidMount: () => void;

            method componentDidUpdate

            componentDidUpdate: (prevProps: Props, prevState: State) => void;

              method componentWillUnmount

              componentWillUnmount: () => void;

                method render

                render: () => React.ReactNode;


                  interface FetchError

                  interface FetchError extends Error {}

                    property code

                    code: string;

                      property errno

                      errno: string;

                        property message

                        message: string;

                          property type

                          type: string;

                            interface Props

                            interface Props
                            extends Omit<React.SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> {}

                              property baseURL

                              baseURL?: string;

                                property cacheRequests

                                cacheRequests?: boolean;

                                  property children

                                  children?: React.ReactNode;

                                    property description

                                    description?: string;

                                      property fetchOptions

                                      fetchOptions?: RequestInit;

                                        property innerRef

                                        innerRef?: React.Ref<SVGElement>;

                                          property loader

                                          loader?: React.ReactNode;

                                            property onError

                                            onError?: ErrorCallback;

                                              property onLoad

                                              onLoad?: LoadCallback;

                                                property preProcessor

                                                preProcessor?: PreProcessorCallback;

                                                  property src

                                                  src: string;

                                                    property title

                                                    title?: string;

                                                      property uniqueHash

                                                      uniqueHash?: string;

                                                        property uniquifyIDs

                                                        uniquifyIDs?: boolean;

                                                          interface State

                                                          interface State {}

                                                            property content

                                                            content: string;

                                                              property element

                                                              element: React.ReactNode;

                                                                property hasCache

                                                                hasCache: boolean;

                                                                  property status

                                                                  status: string;

                                                                    interface StorageItem

                                                                    interface StorageItem {}

                                                                      property content

                                                                      content: string;

                                                                        property queue

                                                                        queue: Callback[];

                                                                          property status

                                                                          status: string;

                                                                            Type Aliases

                                                                            type ErrorCallback

                                                                            type ErrorCallback = (error: Error | FetchError) => void;

                                                                              type LoadCallback

                                                                              type LoadCallback = (src: string, isCached: boolean) => void;

                                                                                type PlainObject

                                                                                type PlainObject<T = unknown> = Record<string | number | symbol, T>;

                                                                                  type PreProcessorCallback

                                                                                  type PreProcessorCallback = (code: string) => string;

                                                                                    Package Files (2)

                                                                                    Dependencies (2)

                                                                                    Dev Dependencies (44)

                                                                                    Peer Dependencies (1)


                                                                                    To add a badge like this badgeto your package's README, use the codes available below.

                                                                                    You may also use to create a custom badge linking to

                                                                                    • Markdown
                                                                                    • HTML
                                                                                      <a href=""><img src="" alt=""></a>