React-Google-Apps-Script
React-Google-Apps-Script copied to clipboard
Best Practice for Server --> Client via Scriptlets, onSelectionChange
If I add a property to a template in ui.js such as:
const template = HtmlService.createTemplateFromFile('sidebar');
template.uuid = 'abc123';
const html = template.evaluate();
html.setTitle('My Sidebar');
SpreadsheetApp.getUi().showSidebar(html);
How do I access "uuid" in React via Scriptlets?
I've tried modifying sidebar/index.html
<script>
window.uuid = JSON.parse(<?= uuid ?>);
console.log(`window.uuid:${window.uuid}`);
</script>
But I'm not seeing anything. It's probably obvious... 😄
On another note... is there any way to push data from server to client when onSelectionChange is called?