From 009516269957d318dfbef116cdf8584402bb5949 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Mon, 27 Aug 2018 23:32:59 -0700 Subject: [PATCH] make it obvious how to unmount --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 47a1692..4ab0882 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,9 @@ var newVnode = h('div#container.two.classes', {on: {click: anotherEventHandler}} ]); // Second `patch` invocation patch(vnode, newVnode); // Snabbdom efficiently updates the old view to the new state + +// to unmount from the DOM and clean up, simply pass null +patch(newVnode, null) ``` ## Examples @@ -175,7 +178,6 @@ var newVNode = h('div', {style: {color: '#000'}}, [ ]); patch(toVNode(document.querySelector('.container')), newVNode) - ``` ### Hooks