StoreFrontFunctionComponent

Not able to use StorefrontFunctionComponent
it shows an error of " Cannot find name ‘StorefrontFunctionComponent’. "
how to resolve it.

Possivelmente você nao está importando corretamente algum app… compartilha o log pra gente?
e se possivel envia o snippet do codigo

Hi @Anmol113 !

Normally StorefrontFunctionComponent is a typing used to address components that needs to use a schema. Probably you’re not importing this typing or it’s not declared in your app. If you don’t already have this typing declared, you can do it as follows:

// react/typings/storefront.d.ts

import { FunctionComponent } from 'react'

declare global {
  interface StorefrontFunctionComponent<P = {}> extends FunctionComponent<P> {
    getSchema?(props: P): object
    schema?: object
  }
}

(In this case you don’t need to import because it’s global)

You can also look for references on how this is used in VTEX apps.

Hope this helps you!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.