Last active
March 22, 2016 03:10
-
-
Save deguchi/6abc28f94ef287aa2bd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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