-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
トップにいくつかの情報を載せたり、ほかのページを追加するための布石として、 動画プレイヤーをトップに配置するのではなくほかのURIのべつのページとして切り出すようにする。 `react-router` v4.0.0を使い、かつdynamic importを使っているため、 該当ページがロードされるまでページ本体のスクリプトファイルは読み込まれない。 そのためページの数が増えても スクリプトファイル自体のファイルサイズが大きくなりすぎることはないのではない。 ……と期待している。
- Loading branch information
Showing
10 changed files
with
200 additions
and
118 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
export default function Home() { | ||
return ( | ||
<div> | ||
{/* home */ } | ||
</div> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { Component, PropTypes } from 'react'; | ||
|
||
export default class Loader extends Component { | ||
static displayName = 'Loader'; | ||
|
||
static propTypes = { | ||
name: PropTypes.string.isRequired, | ||
}; | ||
|
||
state = { | ||
component: null, | ||
}; | ||
|
||
componentDidMount() { | ||
const { name, ...otherProps } = this.props; | ||
import(`./${name}`) | ||
.then(({ default: C }) => { | ||
this.setState({ | ||
component: ( | ||
<C {...otherProps} /> | ||
), | ||
}); | ||
}); | ||
} | ||
|
||
shouldComponentUpdate(nextProps, nextState) { | ||
return this.state.component !== nextState.component; | ||
} | ||
|
||
render() { | ||
return this.state.component; | ||
} | ||
} |
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
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
Oops, something went wrong.