mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
add example cjsx file
This commit is contained in:
40
samples/CoffeeScript/example.cjsx
Normal file
40
samples/CoffeeScript/example.cjsx
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
###* @cjsx React.DOM ###
|
||||||
|
define 'myProject.myComponent', [
|
||||||
|
'React'
|
||||||
|
'myProject.ExampleStore'
|
||||||
|
'myProject.ExampleActions'
|
||||||
|
'myProject.ReactExampleTable'
|
||||||
|
], (React, ExampleStore, ExampleActions, ReactExampleTable ) ->
|
||||||
|
|
||||||
|
ReactListDetail = React.createClass
|
||||||
|
mixins: [ListenMixin]
|
||||||
|
|
||||||
|
getInitialState: ->
|
||||||
|
rows: ExampleStore.getRows()
|
||||||
|
meta: ExampleStore.getMeta()
|
||||||
|
|
||||||
|
componentWillMount: ->
|
||||||
|
@listenTo ExampleStore
|
||||||
|
|
||||||
|
componentDidMount: ->
|
||||||
|
ExampleActions.getExampleData()
|
||||||
|
|
||||||
|
onStoreChange: ->
|
||||||
|
if this.isMounted()
|
||||||
|
@setState
|
||||||
|
rows: ExampleStore.getRows()
|
||||||
|
meta: ExampleStore.getMeta()
|
||||||
|
|
||||||
|
componentWillUnmount: ->
|
||||||
|
@stopListening ExampleStore
|
||||||
|
|
||||||
|
render: ->
|
||||||
|
<div className="page-wrap">
|
||||||
|
<header>
|
||||||
|
<strong> {@state.title} </strong>
|
||||||
|
<header>
|
||||||
|
<ReactExampleTable
|
||||||
|
rows={@state.rows},
|
||||||
|
meta={@state.meta}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user