News for hackers. Stuff that matters.
Re:Ask HN: Overwhelmed with learning front-end, how do I pro... by welanes on Sunday November 06, 2016 @03:20AM (#12884137)
I'm not versed in React but I think this achieves the same thing -

1. Create your custom component:

  var btnComp = {
    props: ['text'],
    template: '<div>I am a button <button v-html="text"></button></div>'
  }
2. Register it:

  new Vue({
    el: 'body',
    components: {
      'custombtn': btnComp
    }
  })
3. Display it:

  <custombtn :text="'hello'"></custombtn>

That's anything but hard. Here: https://jsfiddle.net/v5s77r2x/.

*Updated with simpler code and JSfiddle example

Re:Ask HN: Overwhelmed with learning front-end, how do I pro... by woogley on Sunday November 06, 2016 @08:19AM (#12884930)
It can even be closer to React than that, especially with JSX render functions. You don't even need the view to name itself:

    export default Vue.extend({
      props: ['text'],
      render() {
        return <div>I am a button <button>{this.text}</button></div>;
      }
    });
Re:Ask HN: Overwhelmed with learning front-end, how do I pro... by welanes on Sunday November 06, 2016 @09:06AM (#12885113)
Useful to know. Cheers.