Write single file component like vue.
windyGex opened this issue · 3 comments
windyGex commented
I write a webpack loader named seek-component-loader
. It support write single file component like vue, but using react-templates compile content.
https://github.com/windyGex/react-template-loader
<SeekComponent>
<template>
<input className="new-todo" type="text" placeholder="What needs to be done?"
onKeyDown="{this.handleKeyDown.bind(this)}" />
</template>
<style lange="sass">
.new-todo {
}
</style>
<script>
import React from 'react'
export default class AddTodo extends React.Component{
handleKeyDown (e){
let {handleAddTodo} = this.props;
if (e.keyCode === 13) {
const text = e.target.value.trim()
if (text) {
handleAddTodo(text)
e.target.value = ''
}
}
}
}
</script>
</SeekComponent>
Anyone interested?
nippur72 commented
Cool, it's also similar to RiotJs (no surprise since Riot inspired Vue).
hongbuzz commented
Cool! What I looking for
mikeaustin commented
I was poking around for jsx template solution. I like this. I also found https://www.npmjs.com/package/react-html-template-loader. The benefits are being able to preview the HTML.