loading...
Cover image for Top 5 DEV Comments from the Past Week
The DEV Team

Top 5 DEV Comments from the Past Week

peter profile image Peter Kim Frank ・1 min read

This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the #bestofdev tag.

We start things off with a great reply in the Explain Vue to Me thread. @saurabhdaware offers an explanation:

This is how a Vue component looks like:

<template>
    <div>{{msg}}</div>
</template>
<script>
export default{
    data(){
        return {
            msg: 'Hi I came from JavaScript'
        }
    },
    mounted(){
        setTimeout(() => this.msg = 'I came 3seconds after the component mounted', 3000)
    }
}
</script>
<style scoped>
/* I will only be applied over HTML above, since I have optional 'scoped' attribute */
div{color:red}
</style>

So every component can have its own template styling and scripts.

Just like mounted there are other lifecycle hooks like beforeCreate,created, beforeMount, mounted , and some more.

Vue took best of the things from Angular and React.

(I've wrote this considering Vue 2, I haven't used vue 3 yet)

One advantage I see is, for someone who has only used plain html, css, javascript before, Vue doesn't throw any extra things for him to learn (there are things to learn though but he can still read Vue code without any prior knowledge)

@scottydocs adds their proposal to the Best 404 Page Found Till Now! What do you say? discussion. Lots of amazing candidates in that post:

In theme with Halloween, people shared their tales in What's your spookiest coding story? @cjbrooks12 hits on the true terror of certain situations:

Terror … when you feel something behind you, you hear it, you feel it's breath against you, and you turn around, there's nothing there.
~ Stephen King

The worst terrors are those you know exist, and yet cannot see.

Like invisible characters that choke the life out of your YAML parser.

In The Future of DEV, Ben shared some pull request contribution states. While the number of PRs was a tidy milestone in base-10, @isaacdlyman points out that it was just off the mark for an even 2^9:

this past month we received exactly 500 pull requests.

Too bad it couldn't be a nice round number, like 512.

Book-end'ing this week's top comments is another explanation thread, this time about React in Explain React to Me. @matthewbdaly offers a great rundown:

A React component is essentially just a function that returns HTML. It can accept arguments if necessary, in the form of props, and can use those to determine what it renders.

While a component can technically be a class, it still makes more sense to think of it as a function, and with the advent of Hooks it's probably not necessary to build any one component as a class nowadays.

See you next week for more great comments ✌

Posted on Nov 5 '19 by:

peter profile

Peter Kim Frank

@peter

Doing a bit of everything at DEV.

The DEV Team

The team behind this very platform. 😄

Discussion

markdown guide