Share
Embed
Future of Vue – JSFoo VueDay 2019
On 1st October 2016, we released Vue 2.0. Three years have passed since. The frontend ecosystem, especially JavaScript standards and browsers, have come far. New APIs – e.g., Proxies – are available on most browsers. This has presented us with an opportunity to address the caveats in Vue's reactivity system. We are using this opportunity to address the smaller but important issues in the ecosystem. A cherry on top, significant performance enhancements for Vue 3.
Rahul Kadyan
August 30, 2019
Transcript
162 slides
-
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Platinum
Sponsor Exhibition Sponsor Community Sponsor -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Scale
can mean PEOPLE -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Looked
under the hood -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan React
developer’s love for Vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Vue
3.0 is Coming -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan const
data = vm.$options.data() Object.defineProperty(vm, key, { get() { // track dependency ... return data[key] }, set(value) { data[key] = value // notify dependencies ... } }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan const
data = vm.$options.data() Object.defineProperty(vm, key, { get() { // track dependency ... return data[key] }, set(value) { data[key] = value // notify dependencies ... } }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan const
data = vm.$options.data() Object.defineProperty(vm, key, { get() { // track dependency ... return data[key] }, set(value) { data[key] = value // notify dependencies ... } }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan const
data = vm.$options.data() Object.defineProperty(vm, key, { get() { // track dependency ... return data[key] }, set(value) { data[key] = value // notify dependencies ... } }) Do you see the problem? -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats
Addition/removal of properties Array index or length assignment Linear complexity -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan No
more caveats! -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan No
more caveats! -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan …
and it works with Map Set WeakMap WeakSet Any Other Class -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Faster
much faster than Object.definePrototype -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan v2.6
v3.0 (prototype) Rendering 3000 stateful component instances -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan v2.6
v3.0 (prototype) Rendering 3000 stateful component instances Double Speed -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan v2.6
v3.0 (prototype) Rendering 3000 stateful component instances Half Memory -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan v2.6
v3.0 (prototype) Rendering 3000 stateful component instances Double Speed Half Memory -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Crash
Course: Virtual DOM -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Template
/ DOM <div class="container"> <span>Hello World! </span> </div> -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan {
tag: 'div', attrs: { class: 'container', }, children: [ { tag: ‘span', attrs: {}, children: ['Hello World!'], }, ], } Virtual DOM <div class="container"> <span>Hello World! </span> </div> -
<div class="container"> <span>Hello World! </span> </div> Future of Vue @znck0
JSFoo: VueDay 2019 Rahul Kadyan function render(createElement) { return createElement( 'div', { class: 'container'}, [ createElement('span', {}, ['Hello World!']) ] ) } Render Function -
function render(createElement) { return createElement( 'div', { class: 'container'}, [
createElement('span', {}, ['Hello World!']) ] ) } <div class="container"> <span>Hello World! </span> </div> Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Render Function -
function render(createElement) { return createElement( 'div', { class: 'container'}, [
createElement('span', {}, ['Hello World!']) ] ) } <div class="container"> <span>Hello World! </span> </div> Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Render Function createElement( /* tag */ ‘div', /* attrs */ { class: ‘container'}, /* children */ [ ...] ) -
function render(createElement) { return createElement( 'div', { class: 'container'}, [
createElement('span', {}, ['Hello World!']) ] ) } <div class="container"> <span>Hello World! </span> </div> Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Virtual DOM Node { tag: 'div', attrs: { class: 'container'}, children: [ ...] } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Template
-> Render Function <div class="container"> <span>Hello World! </span> </div> function render(createElement) { return createElement( 'div', { class: 'container'}, [createElement( 'span', {}, ['Hello World!’] )] ) } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Render
Function -> Virtual DOM { tag: 'div', attrs: { class: 'container', }, children: [ { tag: ‘span', attrs: {}, children: ['Hello World!'], }, ], } function render(createElement) { return createElement( 'div', { class: 'container'}, [createElement( 'span', {}, ['Hello World!’] )] ) } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template function render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Element Type Detection -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template function render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Element Type Detection -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template function render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Element Type Detection -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template function render() { const Comp = resolveComponent('Comp', this) return createFragment([ createElement(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElement('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Element Type Detection -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Child
Type Detection function createElement(tag, ...) { if (isComponent(tag)) return createComponentVNode(tag, ...) if (isElement(tag)) return createElementVNode(tag, ...) ... } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template function render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Element Type Detection -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template function render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Element Type Detection -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Monomorphic Calls -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Monomorphic Calls -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Monomorphic Calls -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Monomorphic Calls -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan createElementVNode('span',
null, null, 0 /* no children */) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan createElementVNode('span',
null, null, 0 /* no children */) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan createElementVNode('span',
null, [ ...], 0 /* no children */) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan createElementVNode('span',
null, [ ...], 0 /* no children */) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Component Fast Paths -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
</Comp> <div> <span> </span> </div> Template render() { const Comp = resolveComponent('Comp', this) return createFragment([ createComponentVNode(Comp, null, null, 0 /* no children */), createElementVNode('div', null, [ createElementVNode('span', null, null, 0 /* no children */) ], 2 /* single vnode child */) ], 8 /* multiple non-keyed children */) } Compiler Output Component Fast Paths -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
<div>{{ hello }} </div> </Comp> function render() { return h(Comp, null, { default: [h('div', this.hello)] }, 16 /* compiler generated slots */) } Template Optimised Slot Generation Compiled Output -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
<div>{{ hello }} </div> </Comp> function render() { return h(Comp, null, { default: [h('div', this.hello)] }, 16 /* compiler generated slots */) } Template Optimised Slot Generation Compiled Output -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp>
<div>{{ hello }} </div> </Comp> function render() { return h(Comp, null, { default: () => [h('div', this.hello)] }, 16 /* compiler generated slots */) } Template Optimised Slot Generation Compiled Output -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div>
<span class="foo"> Static </span> <span> {{ dynamic }} </span> </div> Template function render() { return createElementVNode('div', null, [ createElementVNode( 'span', { class: 'foo' }, [createTextVNode('static')], 0 ), createElementVNode( 'span', null, [createTextVNode(this.dynamic)], 0 ), ]) } Compiler Output Static Tree Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div>
<span class="foo"> Static </span> <span> {{ dynamic }} </span> </div> Template function render() { return createElementVNode('div', null, [ createElementVNode( 'span', { class: 'foo' }, [createTextVNode('static')], 0 ), createElementVNode( 'span', null, [createTextVNode(this.dynamic)], 0 ), ]) } Compiler Output Static Tree Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div>
<span class="foo"> Static </span> <span> {{ dynamic }} </span> </div> Template function render() { return createElementVNode('div', null, [ createElementVNode( 'span', { class: 'foo' }, [createTextVNode('static')], 0 ), createElementVNode( 'span', null, [createTextVNode(this.dynamic)], 0 ), ]) } Compiler Output Static Tree Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div>
<span class="foo"> Static </span> <span> {{ dynamic }} </span> </div> Template const __static1 = createElementVNode( 'span', { class: 'foo' }, [createTextVNode('static')], 0 ) function render() { return createElementVNode('div', null, [ __static1, createElementVNode( 'span', null, [createTextVNode(this.dynamic)], 0 ), ]) } Compiler Output Static Tree Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan const
__static1 = createElementVNode( 'span', { class: 'foo' }, [createTextVNode('static')], 0 ) function render() { return createElementVNode('div', null, [ __static1, createElementVNode( 'span', null, [createTextVNode(this.dynamic)], 0 ), ]) } Compiler Output Static Tree Hoisting <div> <span class="foo"> Static </span> <span> {{ dynamic }} </span> </div> Template -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div
id="foo" class="bar"> {{ state }} </div> Template function render() { return createElementVNode( 'div', { id: 'foo', class: 'bar' }, [createTextVNode(this.state)], 0 ) } Compiler Output Static Props Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div
id="foo" class="bar"> {{ state }} </div> Template function render() { return createElementVNode( 'div', { id: 'foo', class: 'bar' }, [createTextVNode(this.state)], 0 ) } Compiler Output Static Props Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div
id="foo" class="bar"> {{ state }} </div> Template const __static1 = { id: 'foo', class: 'bar' } function render() { return createElementVNode( 'div', __static1, [createTextVNode(this.state)], 0 ) } Compiler Output Static Props Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp
@event="count ++" /> Template function render() { const Comp = resolveComponent('Comp', this) return createComponentVNode(Comp, { onEvent: $event => { this.count ++ } }, null, 0) } Compiler Output Inline Event Handler Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp
@event="count ++" /> Template function render() { const Comp = resolveComponent('Comp', this) return createComponentVNode(Comp, { onEvent: $event => { this.count ++ } }, null, 0) } Compiler Output Inline Event Handler Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <Comp
@event="count ++" /> Template const __handler1 = function ($event) { this.count ++ } function render() { const Comp = resolveComponent('Comp', this) return createComponentVNode(Comp, { onEvent: getBoundFunction( __handler1, this) }, null, 0) } Compiler Output Inline Event Handler Hoisting -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan New
Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <div
id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class="text" <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class="text" -> Diff children of <p> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff {{ message }} <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff {{ message }} -> Diff <p> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff {{ message }} -> Diff <p> -> Diff class="text" <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff {{ message }} -> Diff <p> -> Diff class="text" -> Diff children of <p> <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id="content" -> Diff children of <div> -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff {{ message }} -> Diff <p> -> Diff class="text" -> Diff children of <p> -> Diff Lorem ipsum <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <div> -> Diff id=“content" -> Diff children of <div> -> Diff <p> -> Diff class=“text" -> Diff children of <p> -> Diff Lorem ipsum -> Diff <p> -> Diff class=“text" -> Diff children of <p> -> Diff {{ message }} -> Diff <p> -> Diff class=“text" -> Diff children of <p> -> Diff Lorem ipsum <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff {{ message }} <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff {{ message }} <div id="content"> <p class="text">Lorem ipsum </p> <p class="text">{{ message }} </p> <p class="text">Lorem ipsum </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <p> -> Diff {{ message }} <div> <p class="text">Lorem ipsum </p> <p v-if="ok"> <span>Lorem ipsum </span> <span>{{ message }} </span> </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <p> -> Diff {{ message }} <div> <p class="text">Lorem ipsum </p> <p v-if="ok"> <span>Lorem ipsum </span> <span>{{ message }} </span> </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff <p> -> Diff {{ message }} <div> <p class="text">Lorem ipsum </p> <p v-for="message of messages"> <span>Lorem ipsum </span> <span>{{ message }} </span> </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan ->
Diff every <p> -> Diff every {{ message }} <div> <p class="text">Lorem ipsum </p> <p v-for="message of messages"> <span>Lorem ipsum </span> <span>{{ message }} </span> </p> </div> Template Diffing Algorithm Steps New Diffing Algorithm -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan https://github.com/vuejs/rfcs/blob/treeshaking/active-rfcs/0000-global-api-treeshaking.md
import Vue from 'vue' Vue.nextTick(() => { // ... }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan https://github.com/vuejs/rfcs/blob/treeshaking/active-rfcs/0000-global-api-treeshaking.md
import { nextTick } from 'vue' nextTick(() => { // ... }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan https://github.com/vuejs/rfcs/blob/treeshaking/active-rfcs/0000-global-api-treeshaking.md
import { Transition, TransitionGroup, vShow, ... } from 'vue' Tree-Shaking Friendly -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan https://github.com/vuejs/rfcs/blob/treeshaking/active-rfcs/0000-global-api-treeshaking.md
import { Transition, TransitionGroup, vShow, ... } from 'vue' Tree-Shaking Friendly -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Less
than 10kb (gzipped) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <script>
export default { props: ['count'], renderTriggered(event) { debugger } } </script> <template> <div>{{ count }} </div> </template> Render Causation -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <script>
export default { props: ['count'], renderTriggered(event) { debugger } } </script> <template> <div>{{ count }} </div> </template> Render Causation -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan <script>
export default { props: ['count'], renderTriggered(event) { debugger } } </script> <template> <div>{{ count }} </div> </template> Render Causation -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Better
Warning Traces -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ createRenderer } from '@vue/runtime-core' const { render } = createRenderer({ ... }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ createRenderer } from '@vue/runtime-core' const { render } = createRenderer({ ... }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ createRenderer } from '@vue/runtime-core' const { render } = createRenderer({ ... }) -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Vue
3.0 uses TypeScript -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Vue
3.0 uses TypeScript But you don’t have to! -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan http://github.com/vuejs/rfcs
Voice your concerns! -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export default { setup() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export default { setup() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export default { setup() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export default { setup() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export default { setup() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export default { setup() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan return
{ state, increment } } } <button @click="increment"> Count is: {{ state.count }}, double is: {{ state.double }} </button> -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan return
{ state, increment } } } <button @click="increment"> Count is: {{ state.count }}, double is: {{ state.double }} </button> -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export default { setup() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' function useCounter() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } export default { setup() { const { state, increment } = useCounter() -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' function useCounter() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } export default { setup() { const { state, increment } = useCounter() -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan state.count
++ } return { state, increment } } export default { setup() { const { state, increment } = useCounter() return { state, increment } } } -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan return
{ state, increment } } } <button @click="increment"> Count is: {{ state.count }}, double is: {{ state.double }} </button> -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ reactive, computed } from 'vue' export function useCounter() { const state = reactive({ count: 0, double: computed(() => state.count * 2) }) function increment() { state.count ++ } return { state, increment } } counter.js -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ useCounter } from './counter' export default { setup() { const { state, increment } = useCounter() return { state, increment } } } <button @click="increment"> Count is: {{ state.count }}, double is: {{ state.double }} </button> App.vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ useCounter } from './counter' export default { setup() { const { state, increment } = useCounter() return { state, increment } } } <button @click="increment"> Count is: {{ state.count }}, double is: {{ state.double }} </button> App.vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ useCounter } from './counter' export default { setup() { const { state, increment } = useCounter() return { state, increment } } } <button @click="increment"> Count is: {{ state.count }}, double is: {{ state.double }} </button> App.vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ useCounter } from './counter' export default { setup() { const { state, increment } = useCounter() return { state, increment } } } <button @click="increment"> Count is: {{ state.count }}, double is: {{ state.double }} </button> App.vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ useCounter } from './counter' export default { setup() { const { state: counter, increment } = useCounter() return { counter, increment } } } <button @click="increment"> Count is: {{ counter.count }}, double is: {{ counter.double }} </button> App.vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ useCounter } from './counter' export default { setup() { const { state: counter, increment } = useCounter() return { counter, increment } } } <button @click="increment"> Count is: {{ counter.count }}, double is: {{ counter.double }} </button> App.vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan import
{ useCounter } from './counter' export default { setup() { const { state: counter, increment } = useCounter() return { counter, increment } } } <button @click="increment"> Count is: {{ counter.count }}, double is: {{ counter.double }} </button> App.vue -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Frequently
Asked Questions -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Do
we need to learn TypeScript now? -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Does
3.0 break my applications? -
Future of Vue @znck0 JSFoo: VueDay 2019 Rahul Kadyan Do
we have two ways of writing components?