react-redux : rendering
This commit is contained in:
3
react-redux/src/App.js
vendored
3
react-redux/src/App.js
vendored
@@ -1,4 +1,5 @@
|
||||
import "./App.css";
|
||||
import Study from "./Study";
|
||||
|
||||
const Head = (props) => <h1>{props.title}</h1>;
|
||||
|
||||
@@ -6,7 +7,7 @@ function App() {
|
||||
return (
|
||||
<>
|
||||
<Head title="this is a title" name="this is a name" />
|
||||
<Head title="this is a title" name="this is a name" />
|
||||
<Study />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
30
react-redux/src/Study.js
vendored
Normal file
30
react-redux/src/Study.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import React, { Component } from "react";
|
||||
|
||||
const Loading = () => <div>Loading...</div>;
|
||||
|
||||
class Study extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: true,
|
||||
};
|
||||
}
|
||||
|
||||
comment() {
|
||||
const { loading } = this.state;
|
||||
const con = 1;
|
||||
const res = con > 0 ? true : false; // 두가지 조건 (if, else)
|
||||
const and = loading && <div>loading...</div>; // 한가지 조건(if)
|
||||
}
|
||||
render() {
|
||||
const { loading } = this.state;
|
||||
return (
|
||||
<>
|
||||
{loading ? <Loading /> : <div>this is a webpage</div>}
|
||||
{loading && <Loading />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Study;
|
||||
Reference in New Issue
Block a user