Skip to content

Instantly share code, notes, and snippets.

@deguchi
Last active March 22, 2016 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deguchi/6abc28f94ef287aa2bd9 to your computer and use it in GitHub Desktop.
Save deguchi/6abc28f94ef287aa2bd9 to your computer and use it in GitHub Desktop.
/*
app
Copyright (c) 2016 CALIL Inc.
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
*/
'use strict'
var getGlobal = require("get-global");
import React from 'react'
import ReactDOM from 'react-dom'
class App extends React.Component {
constructor(props){
super(props);
this.state = {};
}
render() {
return (
<div>
<h1>App</h1>
<p>something</p>
</div>
)
}
}
/**
* appのスタート関数
* @param id - divのid
* @param options - オプション
*/
getGlobal().app = function(id, options){
ReactDOM.render(
React.createElement(App, options),
document.getElementById(id)
)
}
--
jsxファイルを分割した場合
読み込み側
import Index from './view/index.jsx'
jsxファイル側
export default class Index extends React.Component {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment