React Pluggable

React Pluggable

  • Docs
  • FAQ
  • Github
  • Hire The Creators

›Api References

Getting Started

  • Introduction
  • Installation
  • Motivation

Examples

  • Hello World
  • Renderer Example
  • Event Example
  • Typing Example
  • Todo App

Core Concepts

  • Dependencies
  • Typing
  • How to create a Plugin
  • Events

Api References

  • API Overview
  • Plugin
  • IPlugin
  • PluginStore
  • RendererPlugin

Tips and Tricks

  • Naming Convention

FAQ

  • FAQ's

Plugin

createPluginStore

It returns a new instance of PluginStore.

Arguments: (void)

Returns: (PluginStore)

const pluginStore = createPluginStore();


PluginProvider

The makes the plugin store available to any nested components that are wrapped inside it.

Props

  1. value(PluginStore): The single PluginStore of your application.
  2. children(ReactElement): The root of your component hierarchy.

Example:

const pluginStore = createPluginStore();

function App() {
  return (
    <PluginProvider pluginStore={pluginStore}>
      <Test />
    </PluginProvider>
  );
}


usePluginStore

It is used to get the instance of PluginStore in the components which are nested in PluginProvider.

const pluginStore: any = usePluginStore();

Example:

Here, we are retrieving the instance of PluginStore and calling the sendAlert function contained in the store.

const Test = (props: any) => {
  const pluginStore: any = usePluginStore();

  return (
    <>
      <h1>Working</h1>
      <button
        onClick={() => {
          pluginStore.executeFunction("showAlert");
        }}
      >
        Send Alert
      </button>
    </>
  );
};
← API OverviewIPlugin →
  • createPluginStore
  • PluginProvider
  • usePluginStore
React Pluggable
Docs
Getting StartedExamplesCore ConceptsAPI ReferencesFAQ
Community
TwitterStackoverflowDiscord
More
GitHubContribution Guidelines

Star
Built with ♥ at GeekyAnts
Copyright © 2020 React Pluggable.