Open fx2y opened 1 year ago
use virtual_dom::{Diff, Patch, VDom}
// Initialize virtual DOM from a string of HTML
let vdom = VDom::from_html("<h1>Hello, world!</h1>");
// Update the virtual DOM based on a string of HTML
let updated = VDom::from_html("<h1>Hello, world!</h1><p>This is my website.</p>");
let patches = vdom.diff(&updated);
// Apply patches to the real DOM
let container = document.get_element_by_id("app");
patches.apply(container);
for determining which parts of the DOM need to be updated.