import React from 'react'; import "./css/App.css" import HomePage from "./HomePage"; import RandomPage from "./RandomPage"; // include bootstraps css import 'bootstrap/dist/css/bootstrap.min.css'; class App extends React.Component { constructor(props, context) { super(props, context); this.state = {page: "default"}; // bind this to the method for being able to call methods such as this.setstate this.showVideo = this.showVideo.bind(this); this.hideVideo = this.hideVideo.bind(this); } videoelement = null; MainBody() { let page; if (this.state.page === "default") { page = ; this.mypage = page; } else if (this.state.page === "random") { page = ; this.mypage = page; } else if (this.state.page === "video") { // show videoelement if neccessary page = this.videoelement; } else if (this.state.page === "lastpage") { // return back to last page page = this.mypage; } else { page =
unimplemented yet!
; } return (page); } render() { return (
{this.MainBody()}
); } showVideo(element) { this.setState({ page: "video" }); this.videoelement = element; } hideVideo() { this.setState({ page: "lastpage" }); this.element = null; } } export default App;