Vue.js 100

A presentation at Women Who Code DC Meetup in April 2018 in Arlington County, Arlington, VA, USA by Ben Hong

Slide 1

Slide 1

CODING WORKSHOP VUE.JS 101 GETTING SETUP WIFI Repo: http://bit.ly/2qGa0C6 Network: TPGuest CodeSandbox: http://bit.ly/2HsBsxu Password: #1politics

Slide 2

Slide 2

LET’S GET STARTED! VUE.JS INTRO

Slide 3

Slide 3

WHAT ARE CLIENT-SIDE FRAMEWORKS?

Slide 4

Slide 4

WHAT ARE CLIENT-SIDE FRAMEWORKS? ALLOW YOU TO TAKE CONTROL OF YOUR SITE’S USER EXPERIENCE Ben Hong

Slide 5

Slide 5

Slide 6

Slide 6

MOST POPULAR FRAMEWORKS

Slide 7

Slide 7

MOST POPULAR FRAMEWORKS

Slide 8

Slide 8

ANGULAR OVERVIEW + Developer and maintained by Google + Easy to get something up and running pretty quickly — Most of what was happening seemed like magic — More opinionated on how you should built your app

Slide 9

Slide 9

MOST POPULAR FRAMEWORKS

Slide 10

Slide 10

REACT OVERVIEW + Developed by Facebook and recently granted an MIT license + Great performance due to the use of the virtual DOM + You got a lot better at vanilla JavaScript really quickly — Just getting started had a high learning curve — Unfriendly to non-JavaScript developers — High pace of development resulting in unexpected bugs

Slide 11

Slide 11

MOST POPULAR FRAMEWORKS

Slide 12

Slide 12

COMPARING FRAMEWORKS Angular React Founded By Google Facebook How Opinionated? Opinionated Flexible Learning Curve Easy to start Hard to master Hard to start Intermediate to master Template ngHTML JSX GitHub Stars 93.4k (62% v1)* 93.6k* *As of April 16th, 2018

Slide 13

Slide 13

NG-HTML EXAMPLE

Slide 14

Slide 14

JSX EXAMPLE

Slide 15

Slide 15

COMPARING FRAMEWORKS Angular React Founded By Google Facebook How Opinionated? Opinionated Flexible Learning Curve Easy to start Hard to master Hard to start Intermediate to master Template ngHTML JSX GitHub Stars 93.4k (62% v1)* 93.6k* *As of April 16th, 2018

Slide 16

Slide 16

COMPARING FRAMEWORKS *As of April 11th, 2018

Slide 17

Slide 17

Credit - xkcd: Standards (https://xkcd.com/927/)

Slide 18

Slide 18

COMPARING FRAMEWORKS *As of April 11th, 2018

Slide 19

Slide 19

COMPARING FRAMEWORKS *As of April 11th, 2018

Slide 20

Slide 20

VUE OVERVIEW + Open-source framework with no corporate influence + Takes the best of both worlds and bring them together + It does not alienate non-JavaScript developers + Great performance that is on par if not better than React.js + Flexible and accommodating to how you prefer to build apps — No corporate backing and has a “smaller” community compared to React / Angular

Slide 21

Slide 21

COMPARING THE TOP 3 FRAMEWORKS Angular React Vue Founded By Google Facebook Evan You How Opinionated? Opinionated Flexible Guidance as needed Learning Curve Easy to start Hard to master Template ngHTML JSX vHTML (optional) GitHub Stars 93.4k (62% v1)* 93.6k* 91k* Hard to start Easy to start Moderate to master Moderate to master *As of April 18th, 2018

Slide 22

Slide 22

WHICH FRAMEWORK SHOULD YOU CHOOSE?

Slide 23

Slide 23

IT DEPENDS

Slide 24

Slide 24

CHOOSE VUE

Slide 25

Slide 25

Slide 26

Slide 26

AN OVERVIEW OF VUE.JS BASICS

Slide 27

Slide 27

AN INSTANCE OF VUE.JS

Slide 28

Slide 28

EXPRESSIONS IN VUE.JS

Slide 29

Slide 29

CODING EXERCISE THAT WAS EASY!

Slide 30

Slide 30

LET’S TALK ABOUT DIRECTIVES

Slide 31

Slide 31

Directives are the part of Vue.js that are a bit magical…

Slide 32

Slide 32

VUE.JS BASICS: DIRECTIVES WHAT ARE DIRECTIVES EXACTLY? They are Vue specific syntax that flow you to accomplish common goals without worrying about how it is implemented ▸ v-if ▸ v-for ▸ v-else-if ▸ v-bind ▸ v-else ▸ v-on ▸ v-show ▸ v-model

Slide 33

Slide 33

DIRECTIVES: V-IF / V-ELSE-IF / V-ELSE V-IF / V-ELSE-IF / V-ELSE Allows you to determine whether an element on the page should exist

Slide 34

Slide 34

DIRECTIVES: V-SHOW V-SHOW Allows you to determine whether an element on the page should be visible VS V-IF / V-ELSE-IF / V-ELSE Allows you to determine whether an element on the page should exist

Slide 35

Slide 35

Slide 36

Slide 36

DIRECTIVES: V-FOR V-FOR Allows us to “render a list of items based on an array (or object).”

Slide 37

Slide 37

DIRECTIVES: V-BIND V-BIND Allows us to manipulate HTML attributes with dynamic data

Slide 38

Slide 38

DIRECTIVES: V-ON V-ON Allows us to attach methods to HTML elements when a certain event occurs

Slide 39

Slide 39

DIRECTIVES: V-MODEL V-MODEL Allows us to use two-way binding

Slide 40

Slide 40

ENOUGH TALKING. LET’S SEE SOME CODE!

Slide 41

Slide 41

CODING EXERCISE HARRY POTTER WORLD

Slide 42

Slide 42

CODING EXERCISE BASIC CALCULATOR

Slide 43

Slide 43

CODING WORKSHOP VUE.JS 101 GETTING SETUP Repo: http://bit.ly/2qGa0C6

Slide 44

Slide 44

GETTING SETUP http://www.github.com/bencodezen

Slide 45

Slide 45

AS WE COME TO A CLOSE… FINAL THOUGHTS

Slide 46

Slide 46

#1. ACCESSIBLE TO DEVELOPERS OF PRETTY MUCH ALL ABILITIES

Slide 47

Slide 47

JSX EXAMPLE

Slide 48

Slide 48

SINGLE FILE COMPONENT (SFC)

Slide 49

Slide 49

#2. THEIR DOCS ARE ONE OF THE BEST OUT THERE

Slide 50

Slide 50

VUE.JS DOCS https://vuejs.org/v2/guide/

Slide 51

Slide 51

#3. IT IS THERE WHEN YOU NEED IT AND THEN IT GETS OUT OF YOUR WAY.

Slide 52

Slide 52

VUE.JS STYLE GUIDE https://vuejs.org/v2/style-guide/

Slide 53

Slide 53

WHY VUE.JS? VUE.JS IS THE MOST COMPASSIONATE FRAMEWORK IN THE MARKET RIGHT NOW. Ben Hong

Slide 54

Slide 54

WHY VUE.JS? GIVES ME WHAT I WANT WHEN I NEED IT, AND THEN IT GETS OUT OF MY WAY. Sarah Drasner

Slide 55

Slide 55

NEXT STEPS… SO WHAT ELSE IS THERE TO LEARN ABOUT? ▸ State Management ▸ Watch Property ▸ Animations ▸ Component Props ▸ Custom Events ▸ Lifecycle Hooks ▸ Computed Properties ▸ Mixins ▸ Managing CSS in Vue.js ▸ Filters ▸ Slots ▸ And much more!

Slide 56

Slide 56

NEXT STEPS… WHAT OTHER RESOURCES DO YOU RECOMMEND? Paid ▸ Udemy: Vue.js 2 - The Complete Guide ▸ Frontend Masters: Introduction to Vue.js Free ▸ Official Vue.js Guide ▸ VueDC: VueJS 101: The Essentials ▸ VueDC Meetups

Slide 57

Slide 57

Q&A

Slide 58

Slide 58

@BENCODEZEN