Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: separated code blocks for the React plugin example #349

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/key-topics/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ This is the whole concept. Keep in mind that you will never need to create your

The `@webiny/plugins` package always exports one ready-made instance of the `PluginsContainer`, so you never need to create it yourself. Think of it as a globally accessible singleton. We need a singleton to import plugins from other `npm` packages, and by having them all import this same package (`@webiny/plugins`), at _build time_, they will be referencing the same webpack module. This means that at _runtime_, all the external plugins will be working with this one centralized registry, and will be able to access all of your app's plugins.

```ts title="Working With Plugins in React"
```ts title="Working With Plugins in React - Register plugin"
// Import the global plugins container.
import { plugins } from "@webiny/plugins";

Expand All @@ -78,7 +78,9 @@ plugins.register({
alert("Hello, adventurer!");
}
});
```

```ts title="Working With Plugins in React - Invoke plugin"
// Use plugins anywhere in your application (even in 3rd party npm packages).
import { plugins } from "@webiny/plugins";

Expand Down