UNPKG

698 BJavaScriptView Raw
1import { patch } from './vdom'
2
3/**
4 * A function to update a functional component already mounted in the DOM. The first argument can be either a JSX tag or an h function.
5 * @example
6 *
7 * ```
8 * // Update Title tag into section:
9 * const element = mount(<Title message='Hello World!'/>, 'section')
10 * // Pass the captured element to the render function:
11 * render(<Title message='Hello Everyone!'/>, element, 'header')
12 * ```
13 * @typedef {import('./vnode').VNode} VNode
14 * @param {VNode} oldVNode
15 * @param {VNode} newVNode
16 * @param {Element | string} container
17 * @return {VNode} VNode
18 */
19export function render(newVNode, oldVNode, container) {
20 return patch(newVNode, oldVNode, container)
21}