Hi everyone!
Is it possible to create a small UI using react inside a plugin?
I'm trying to use it inside a plugin panel following the React tutorial, but I get the error Uncaught ReferenceError: React is not defined
.
In my plugin i have the following code for creating the panel:
//Create the plugin panel
pluginPanel = await panels.create('panel_1');
await panels.hide(pluginPanel);
await panels.setHtml(pluginPanel, 'Loading... :)');
await panels.addScript(pluginPanel, './webview.js')
await panels.addScript(pluginPanel, './react.development.js')
await panels.addScript(pluginPanel, './react-dom.development.js')
await panels.addScript(pluginPanel, './like_button.js')
await updateNoteVariablesPanel();
and:
async function updateNoteVariablesPanel() {
await panels.setHtml(pluginPanel, `
<div id="like_button_container"></div>
<script src="react.development.js" crossorigin></script>
<script src="react-dom.development.js" crossorigin></script>
<script src="like_button.js"></script>
`)
}
I downloaded the react.development.js
and react-dom.development.js
scripts and put them in src.