#tips ## The Simplest Possible App **@onClick** ```jsx os.registerApp('testApp', thisBot) os.compileApp('testApp', <div>Hello</div>) ``` ## Unregistering > Worth doing in case the app is already open (unregistering will clean up the old one) **@onClick** ```jsx os.unregisterApp('testApp') os.registerApp('testApp', thisBot) os.compileApp('testApp', <div>Hello</div>) ``` ## Making it Nice **@onInit** ```javascript if (os.getCurrentDimension()) { // Get the app const App = thisBot.getApp() // Register app (and un-register in case not the first time) await os.unregisterApp(tags.appID) await os.registerApp(tags.appID, thisBot) // Compile the app os.compileApp(tags.appID, <App /> ); } ``` **@getApp** ```JSX const { useState, useEffect } = os.appHooks const App = () => { const [num, setNum] = useState(0) useEffect(() => { os.toast(`New number: ${num}`) }, [num]) return (<> <style>{tags['App.css']}</style> <div> Simple Clicking app <br /> <button onClick={() => setNum(num + 1)}> <span class="md-icon"> ads_click </span> Click me! </button> <br /> Click Count: {num} </div> </>) } return App ```