Skip to content

Instantly share code, notes, and snippets.

@DC3
Created August 15, 2017 07:01
Show Gist options
  • Select an option

  • Save DC3/168858b1875e56d22a96700ce7330da1 to your computer and use it in GitHub Desktop.

Select an option

Save DC3/168858b1875e56d22a96700ce7330da1 to your computer and use it in GitHub Desktop.
React with CoffeeScrpt playground
React = @React or require 'react'
win = window
doc = win.document
class ExampleComponent extends React.Component
mixins: [React.DOM]
getInitialState: ->
name: 'DC3'
render: ->
@div null, "hello world form react! #{@state.name}"
win.Example = Example
win.ExampleComponent = ExampleComponent
Example = ExampleComponent.build()
win.onload = -> win.app = React.render Example(), doc.getElementById('main')
doctype html
html(lang="zh-cn")
head
title React with CoffeeScrpt playground
body
div#main hello world!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment