What is Declarativas?
Last updated
Was this helpful?
Last updated
Was this helpful?
is a zero-dependency javascript library for declarative HTML 5 canvas context2d drawing. If you are familiar with how React renders to the DOM, aims to be that for HTML canvas applications.
The has a thorough set of properties and draw functions to make it easy to just draw something on a web page. Wrapping these properties and operations in components gives users familiar with declarative web applications, like , , and .
With a basic set of property and draw operation components, declarativas provides a set of building blocks that can be constructed together to build fantastic looking and functioning components. Components are just functions that return other components, just like in your favourite declarative front-end framework.
One thing that can be hard to track down when using the canvas is the canvas state. It's easy to apply a transform, but forget to reset it for your next render, providing hours or days of canvas debugging. Using some higher level, built-in components, you can easily ensure that the state of the canvas does not bleed into your next render (unless you want it to!).
While declarativas is functional and declarative, it is not reactive. All this means is that batteries are not included for state management. While this can seem like an important feature, what this does is make it incredibly easy to integrate into your favourite front-end framework, which probably already includes state management. If you want state management without a separate framework, you could check out , a state management library that works similar to and 's state management.