You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hooks concept introduced by React could be very fitting to use since a component in supernova is very similar in terms of lifecycle. Custom hooks could easily be shared for reusability and increased productivity.
Example hooks:
useState to handle state (same as React)
useLayout to consume a layout
useModel to access the current object's enigma model
useApp to access the app model
useTheme to consume a theme
useResize to handle a resize
import{useLayout,useResize}from'@nebula.js/supernova'exportdefaultfunction(){{qae: {/* */},component(){const[state,setState]=useState({});const[layout]=useLayout();useResize(()=>{/* do stuff on resize */});// render stuff}}}
The text was updated successfully, but these errors were encountered:
The hooks concept introduced by React could be very fitting to use since a component in supernova is very similar in terms of lifecycle. Custom hooks could easily be shared for reusability and increased productivity.
Example hooks:
useState
to handle state (same as React)useLayout
to consume a layoutuseModel
to access the current object's enigma modeluseApp
to access the app modeluseTheme
to consume a themeuseResize
to handle a resizeThe text was updated successfully, but these errors were encountered: