Skip to content

Instantly share code, notes, and snippets.

@maberer
maberer / reactStateHandling.md
Last active August 29, 2015 14:14
Handling of batched state in react’s diff algorithm

#Some notes / further details based on the excellent article React’s diff algorithm

Assuming that react has batched multiple setState() calls that come from different component nodes (batched, because all calls happend before the js event loop ended), all of the given statements below are TRUE:

  • If multiple setState() calls are batched, react always looks first at the topmost dirty component and starts rendering from there.

  • React renders a tree of components until all dirty components have run/been touched exactly once.

@maberer
maberer / gist:b49c9d9b3ff0f1e9d0da
Last active August 29, 2015 14:23
body wrapper
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>
<layout-placeholder name="title"/>
</title>
<!--
<link> tags to include optimized CSS URLs will be included below:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js" integrity="sha384-NaWTHo/8YCBYJ59830LTz/P4aQZK1sS0SneOgAvhsIl3zBu8r9RevNg5lHCHAuQ/" crossorigin="anonymous"></script>
</head>
<body>
<h1>Demo for jsPDF precision drawing very small arc dimensions</h1>
</body>
func testRender() {
pdf := gofpdf.New("P", "mm", "A3", "")
pdf.AddPage()
const x = 200.0
const y = 200.0
const gapAngle = 40.00
const segmAngle = 16.00
const lineWidthOuterRing = 0.20