Skip to content

Commit dd01172

Browse files
committed
Passing components instead of elements
1 parent 49555a2 commit dd01172

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

example/Plugins/ClickMePlugin.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,14 @@ class ClickMePlugin implements IPlugin {
1010
this.pluginStore = pluginStore;
1111
}
1212

13-
getReactComponent(): React.Component {
14-
return <h1>asdjkdas</h1>;
15-
}
16-
1713
activate() {
1814
this.pluginStore.addFunction('sendAlert', () => {
1915
alert('Testing');
2016
});
2117

22-
this.pluginStore.executeFunction(
23-
'RendererPlugin.add',
24-
'top',
25-
this.getReactComponent()
26-
);
18+
this.pluginStore.executeFunction('RendererPlugin.add', 'top', () => (
19+
<h1>asdjkdas</h1>
20+
));
2721
}
2822
deactivate() {
2923
//

src/plugins/RendererPlugin/components/Renderer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export const Renderer: React.SFC<{
1212
);
1313

1414
return (
15-
<React.Fragment>
16-
{components.map((component: any) => (
17-
<>{component}</>
15+
<>
16+
{components.map((Component: any) => (
17+
<Component />
1818
))}
19-
</React.Fragment>
19+
</>
2020
);
2121
};

0 commit comments

Comments
 (0)