react-redux : rendering

This commit is contained in:
haerong22
2021-03-08 02:32:44 +09:00
parent 2b51bcc65d
commit aa498f8ee9
2 changed files with 32 additions and 1 deletions

View File

@@ -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
View 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;