npm install @meursyphus/flitter
This example demonstrates how to render widgets using the AppRunner
class. AppRunner
is initialized with an SVG element as the view
property, which is referenced through React’s useRef
. The widget is created using the Container
function, which includes a Text
widget as a child.
Within the useEffect
hook, an AppRunner
instance is created, and a resize event is set up through the onMount
method. Afterwards, the runApp
method is called to render the widget. When the component unmounts, the dispose
method is called to clean up resources.
Through this process, the widget defined within the SVG element is rendered, and the layout is automatically updated according to screen size adjustments. This is handled by the AppRunner
’s handleViewResize
method.
Using the @meursyphus/flitter
library in this way allows for declarative and reactive data visualization without complex DOM manipulation.