서버에 대해서 공부
https://www.youtube.com/watch?v=NrQZtdwAV0c&list=PLuHgQVnccGMBnrdKRODJmbH7UZ2A48LBK&index=7
https://www.youtube.com/watch?v=4ORZ1GmjaMc
import React, { Component } from "react";
import TOC from "./components/TOC.js";
import Content from "./components/Content.js";
import Subject from "./components/Subject.js";
import "./App.css";
class App extends Component {
constructor(props) {
super(props);
this.state = {
mode: "read",
subject: { title: "WEB", sub: "World Wide Web!" },
welcome: { title: "Welcome", desc: "Hello, React!!" },
contents: [
{ id: 1, title: "HTML", desc: "HTML is for information" },
{ id: 2, title: "CSS", desc: "CSS is for design" },
{ id: 3, title: "JavaScript", desc: "JavaScript is for interactive" },
],
};
}
render() {
var _title,
_desc = null;
if (this.state.mode === "welcome") {
_title = this.state.welcome.title;
_desc = this.state.welcome.desc;
} else if (this.state.mode === "read") {
_title = this.state.contents[0].title;
_desc = this.state.contents[0].desc;
}
return (
<div className="App">
<Subject
title={this.state.subject.title}
sub={this.state.subject.sub}
/>
<Subject title="React" sub="For UI" />
<TOC data={this.state.contents} />
<Content title={_title} desc={_desc} />
</div>
);
}
}
export default App;