Why Declarativas?
Comparisons
Summary
Declarativas Goals
Raw Canvas
const ctx = document.querySelector('canvas').getContext('2d');
const draw = (lastTimestamp, angle) => (timestamp) => {
const delta = lastTimestamp
? (timestamp - lastTimestamp) / 1000
: 0;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.save();
ctx.translate(100, 100);
ctx.rotate(angle * Math.PI / 180);
ctx.fillStyle = 'blue';
ctx.fillRect(-10, -10, 20, 20);
ctx.restore();
requestAnimationFrame(draw(timestamp, angle + (10 * delta)));
}
requestAnimationFrame(draw(null, 0));Pros
Cons
Declarativas without JSX
Pros
Cons
Declarativas with JSX
Pros
Cons
TL;DR
Last updated