김건희

[Add] Redux Initial Setting

...@@ -2340,6 +2340,15 @@ ...@@ -2340,6 +2340,15 @@
2340 "@types/node": "*" 2340 "@types/node": "*"
2341 } 2341 }
2342 }, 2342 },
2343 + "@types/hoist-non-react-statics": {
2344 + "version": "3.3.1",
2345 + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
2346 + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==",
2347 + "requires": {
2348 + "@types/react": "*",
2349 + "hoist-non-react-statics": "^3.3.0"
2350 + }
2351 + },
2343 "@types/html-minifier-terser": { 2352 "@types/html-minifier-terser": {
2344 "version": "6.1.0", 2353 "version": "6.1.0",
2345 "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", 2354 "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz",
...@@ -2522,6 +2531,11 @@ ...@@ -2522,6 +2531,11 @@
2522 "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", 2531 "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz",
2523 "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" 2532 "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
2524 }, 2533 },
2534 + "@types/use-sync-external-store": {
2535 + "version": "0.0.3",
2536 + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz",
2537 + "integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA=="
2538 + },
2525 "@types/ws": { 2539 "@types/ws": {
2526 "version": "8.5.3", 2540 "version": "8.5.3",
2527 "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", 2541 "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
...@@ -6210,6 +6224,21 @@ ...@@ -6210,6 +6224,21 @@
6210 "@babel/runtime": "^7.7.6" 6224 "@babel/runtime": "^7.7.6"
6211 } 6225 }
6212 }, 6226 },
6227 + "hoist-non-react-statics": {
6228 + "version": "3.3.2",
6229 + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
6230 + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
6231 + "requires": {
6232 + "react-is": "^16.7.0"
6233 + },
6234 + "dependencies": {
6235 + "react-is": {
6236 + "version": "16.13.1",
6237 + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
6238 + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
6239 + }
6240 + }
6241 + },
6213 "hoopy": { 6242 "hoopy": {
6214 "version": "0.1.4", 6243 "version": "0.1.4",
6215 "resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz", 6244 "resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz",
...@@ -10080,6 +10109,26 @@ ...@@ -10080,6 +10109,26 @@
10080 "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", 10109 "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
10081 "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" 10110 "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
10082 }, 10111 },
10112 + "react-redux": {
10113 + "version": "8.0.1",
10114 + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.1.tgz",
10115 + "integrity": "sha512-LMZMsPY4DYdZfLJgd7i79n5Kps5N9XVLCJJeWAaPYTV+Eah2zTuBjTxKtNEbjiyitbq80/eIkm55CYSLqAub3w==",
10116 + "requires": {
10117 + "@babel/runtime": "^7.12.1",
10118 + "@types/hoist-non-react-statics": "^3.3.1",
10119 + "@types/use-sync-external-store": "^0.0.3",
10120 + "hoist-non-react-statics": "^3.3.2",
10121 + "react-is": "^18.0.0",
10122 + "use-sync-external-store": "^1.0.0"
10123 + },
10124 + "dependencies": {
10125 + "react-is": {
10126 + "version": "18.1.0",
10127 + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.1.0.tgz",
10128 + "integrity": "sha512-Fl7FuabXsJnV5Q1qIOQwx/sagGF18kogb4gpfcG4gjLBWO0WDiiz1ko/ExayuxE7InyQkBLkxRFG5oxY6Uu3Kg=="
10129 + }
10130 + }
10131 + },
10083 "react-refresh": { 10132 "react-refresh": {
10084 "version": "0.11.0", 10133 "version": "0.11.0",
10085 "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", 10134 "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
...@@ -10296,6 +10345,20 @@ ...@@ -10296,6 +10345,20 @@
10296 "strip-indent": "^3.0.0" 10345 "strip-indent": "^3.0.0"
10297 } 10346 }
10298 }, 10347 },
10348 + "redux": {
10349 + "version": "4.2.0",
10350 + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.0.tgz",
10351 + "integrity": "sha512-oSBmcKKIuIR4ME29/AeNUnl5L+hvBq7OaJWzaptTQJAntaPvxIJqfnjbaEiCzzaIz+XmVILfqAM3Ob0aXLPfjA==",
10352 + "requires": {
10353 + "@babel/runtime": "^7.9.2"
10354 + }
10355 + },
10356 + "redux-devtools-extension": {
10357 + "version": "2.13.9",
10358 + "resolved": "https://registry.npmjs.org/redux-devtools-extension/-/redux-devtools-extension-2.13.9.tgz",
10359 + "integrity": "sha512-cNJ8Q/EtjhQaZ71c8I9+BPySIBVEKssbPpskBfsXqb8HJ002A3KRVHfeRzwRo6mGPqsm7XuHTqNSNeS1Khig0A==",
10360 + "dev": true
10361 + },
10299 "regenerate": { 10362 "regenerate": {
10300 "version": "1.4.2", 10363 "version": "1.4.2",
10301 "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", 10364 "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
...@@ -11927,6 +11990,11 @@ ...@@ -11927,6 +11990,11 @@
11927 "prepend-http": "^2.0.0" 11990 "prepend-http": "^2.0.0"
11928 } 11991 }
11929 }, 11992 },
11993 + "use-sync-external-store": {
11994 + "version": "1.1.0",
11995 + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.1.0.tgz",
11996 + "integrity": "sha512-SEnieB2FPKEVne66NpXPd1Np4R1lTNKfjuy3XdIoPQKYBAFdzbzSZlSn1KJZUiihQLQC5Znot4SBz1EOTBwQAQ=="
11997 + },
11930 "util-deprecate": { 11998 "util-deprecate": {
11931 "version": "1.0.2", 11999 "version": "1.0.2",
11932 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 12000 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
13 "nodemon": "^2.0.16", 13 "nodemon": "^2.0.16",
14 "react": "^18.1.0", 14 "react": "^18.1.0",
15 "react-dom": "^18.1.0", 15 "react-dom": "^18.1.0",
16 + "react-redux": "^8.0.1",
16 "react-router-dom": "^6.3.0", 17 "react-router-dom": "^6.3.0",
17 "react-scripts": "5.0.1", 18 "react-scripts": "5.0.1",
19 + "redux": "^4.2.0",
18 "web-vitals": "^2.1.4" 20 "web-vitals": "^2.1.4"
19 }, 21 },
20 "scripts": { 22 "scripts": {
...@@ -40,5 +42,8 @@ ...@@ -40,5 +42,8 @@
40 "last 1 firefox version", 42 "last 1 firefox version",
41 "last 1 safari version" 43 "last 1 safari version"
42 ] 44 ]
45 + },
46 + "devDependencies": {
47 + "redux-devtools-extension": "^2.13.9"
43 } 48 }
44 } 49 }
......
...@@ -2,7 +2,7 @@ import React, { useCallback, useState } from "react"; ...@@ -2,7 +2,7 @@ import React, { useCallback, useState } from "react";
2 import "../style/RegisterPage.scss" 2 import "../style/RegisterPage.scss"
3 3
4 function RegisterPage(props) { 4 function RegisterPage(props) {
5 - 5 +
6 const [Name, setName] = useState(""); 6 const [Name, setName] = useState("");
7 const [Sex, setSex] = useState(""); 7 const [Sex, setSex] = useState("");
8 const [Id, setId] = useState(""); 8 const [Id, setId] = useState("");
...@@ -65,7 +65,7 @@ function RegisterPage(props) { ...@@ -65,7 +65,7 @@ function RegisterPage(props) {
65 //비밀번호를 입력할때마다 password 를 검증하는 함수 65 //비밀번호를 입력할때마다 password 를 검증하는 함수
66 setPasswordError(event.currentTarget.value !== Password); 66 setPasswordError(event.currentTarget.value !== Password);
67 setPasswordCheck(event.currentTarget.value); 67 setPasswordCheck(event.currentTarget.value);
68 - },[PasswordError]); 68 + }, [PasswordError]);
69 69
70 const onSubmitHandler = useCallback((event) => { 70 const onSubmitHandler = useCallback((event) => {
71 event.preventDefault(); 71 event.preventDefault();
...@@ -90,7 +90,7 @@ function RegisterPage(props) { ...@@ -90,7 +90,7 @@ function RegisterPage(props) {
90 } 90 }
91 91
92 if (!checkRegisterError) { 92 if (!checkRegisterError) {
93 - const userdata = { 93 + const UserData = {
94 name: Name, 94 name: Name,
95 id: Id, 95 id: Id,
96 password: Password, 96 password: Password,
...@@ -101,11 +101,11 @@ function RegisterPage(props) { ...@@ -101,11 +101,11 @@ function RegisterPage(props) {
101 }, [checkIdError, checkNameError, checkPasswordError, checkRegisterError, checkSexError, Password, PasswordCheck, Sex]); 101 }, [checkIdError, checkNameError, checkPasswordError, checkRegisterError, checkSexError, Password, PasswordCheck, Sex]);
102 102
103 return ( 103 return (
104 - <div id = "body"> 104 + <div id="body">
105 <div className="register-box"> 105 <div className="register-box">
106 <h2>회원가입</h2> 106 <h2>회원가입</h2>
107 <div className="input-area"> 107 <div className="input-area">
108 - <input 108 + <input
109 placeholder="이름" 109 placeholder="이름"
110 type="text" 110 type="text"
111 value={Name} 111 value={Name}
...@@ -113,10 +113,10 @@ function RegisterPage(props) { ...@@ -113,10 +113,10 @@ function RegisterPage(props) {
113 /> 113 />
114 </div> 114 </div>
115 <div className="check-variable"> 115 <div className="check-variable">
116 - {checkNameError && <div style={{color : 'red'}}>이름을 두글자 이상 입력해 주세요.</div>} 116 + {checkNameError && <div style={{ color: 'red' }}>이름을 두글자 이상 입력해 주세요.</div>}
117 </div> 117 </div>
118 <div className="input-area"> 118 <div className="input-area">
119 - <input 119 + <input
120 placeholder="아이디" 120 placeholder="아이디"
121 type="text" 121 type="text"
122 value={Id} 122 value={Id}
...@@ -124,10 +124,10 @@ function RegisterPage(props) { ...@@ -124,10 +124,10 @@ function RegisterPage(props) {
124 /> 124 />
125 </div> 125 </div>
126 <div className="check-variable"> 126 <div className="check-variable">
127 - {checkIdError && <div style={{color : 'red'}}>아이디는 6자리 이상 14자리 이하 소문자와 숫자로 입력해주세요.</div>} 127 + {checkIdError && <div style={{ color: 'red' }}>아이디는 6자리 이상 14자리 이하 소문자와 숫자로 입력해주세요.</div>}
128 </div> 128 </div>
129 <div className="input-area"> 129 <div className="input-area">
130 - <input 130 + <input
131 placeholder="비밀번호" 131 placeholder="비밀번호"
132 type="text" 132 type="text"
133 value={Password} 133 value={Password}
...@@ -135,10 +135,10 @@ function RegisterPage(props) { ...@@ -135,10 +135,10 @@ function RegisterPage(props) {
135 /> 135 />
136 </div> 136 </div>
137 <div className="check-variable"> 137 <div className="check-variable">
138 - {checkPasswordError && <div style={{color : 'red'}}>알파벳과 숫자, 특수문자를 포함하여 8자리 이상 입력해주세요.</div>} 138 + {checkPasswordError && <div style={{ color: 'red' }}>알파벳과 숫자, 특수문자를 포함하여 8자리 이상 입력해주세요.</div>}
139 </div> 139 </div>
140 <div className="input-area"> 140 <div className="input-area">
141 - <input 141 + <input
142 placeholder="비밀번호 재입력" 142 placeholder="비밀번호 재입력"
143 type="text" 143 type="text"
144 value={PasswordCheck} 144 value={PasswordCheck}
...@@ -146,31 +146,31 @@ function RegisterPage(props) { ...@@ -146,31 +146,31 @@ function RegisterPage(props) {
146 /> 146 />
147 </div> 147 </div>
148 <div className="check-variable"> 148 <div className="check-variable">
149 - {PasswordError && <div style={{color : 'red'}}>비밀번호가 일치하지 않습니다.</div>} 149 + {PasswordError && <div style={{ color: 'red' }}>비밀번호가 일치하지 않습니다.</div>}
150 </div> 150 </div>
151 <div className="input-area"> 151 <div className="input-area">
152 - <input 152 + <input
153 - type="radio" 153 + type="radio"
154 - value = "0" 154 + value="0"
155 - checked = {Sex === "0"} 155 + checked={Sex === "0"}
156 onChange={onSexHandler} 156 onChange={onSexHandler}
157 /> 157 />
158 - <input 158 + <input
159 - type="radio" 159 + type="radio"
160 - value = "1" 160 + value="1"
161 - checked = {Sex === "1"} 161 + checked={Sex === "1"}
162 onChange={onSexHandler} 162 onChange={onSexHandler}
163 /> 163 />
164 </div> 164 </div>
165 <div className="btn-area" onClick={onSubmitHandler}> 165 <div className="btn-area" onClick={onSubmitHandler}>
166 - <button 166 + <button
167 className="register-btn" 167 className="register-btn"
168 > 168 >
169 가입하기 169 가입하기
170 </button> 170 </button>
171 </div> 171 </div>
172 <div className="check-variable"> 172 <div className="check-variable">
173 - {checkRegisterError && <div style={{color : 'red'}}>정보를 제대로 입력해주세요.</div>} 173 + {checkRegisterError && <div style={{ color: 'red' }}>정보를 제대로 입력해주세요.</div>}
174 </div> 174 </div>
175 </div> 175 </div>
176 </div> 176 </div>
......