State-full functional DOM templating