Home > @plasmicapp/loader-react > PlasmicComponentLoader
PlasmicComponentLoader class
Library for fetching component data, and registering custom components.
Signature:
export declare class PlasmicComponentLoader
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(internal) | Constructs a new instance of the PlasmicComponentLoader class |
Methods
Method | Modifiers | Description |
---|---|---|
_getActiveVariation(opts) | protected |
|
clearCache() | ||
fetchComponentData(specs) | Pre-fetches component data needed to for PlasmicLoader to render these components. Should be passed into PlasmicRootProvider as the prefetchedData prop. You can look up a component either by: - the name of the component - the path for a page component - an array of strings that make up parts of the path - object { name: "name_or_path", projectId: ...}, to specify which project to use, if multiple projects have the same component name Throws an Error if a specified component to fetch does not exist in the Plasmic project. |
|
fetchComponents() | Returns all components metadata for these projects. | |
fetchPages(opts) | Returns all the page component metadata for these projects. | |
getActiveSplits() | ||
getActiveVariation(opts) | ||
getExternalVariation(variation, filters) | ||
maybeFetchComponentData(specs) | Like fetchComponentData(), but returns null instead of throwing an Error when a component is not found. Useful when you are implementing a catch-all page and want to check if a specific path had been defined for Plasmic. | |
registerComponent(component, meta) | Register code components to be used on Plasmic Editor. | |
registerComponent(component, name) | [[deprecated]] Please use substituteComponent instead for component substitution, or the other registerComponent overload to register code components to be used on Plasmic Editor. |
|
registerFunction(fn, meta) | ||
registerGlobalContext(context, meta) | ||
registerModules(modules) | ||
registerToken(token) | ||
registerTrait(trait, meta) | ||
setGlobalVariants(globalVariants) | Sets global variants to be used for all components. Note that this is not reactive, and will not re-render all components already mounted; instead, it should be used to activate global variants that should always be activated for the lifetime of this app. If you'd like to reactively change the global variants, you should specify them via |
|
substituteComponent(component, name) | Register custom components that should be swapped in for components defined in your project. You can use this to swap in / substitute a Plasmic component with a "real" component. | |
trackConversion(value) |