프로그래밍/React 5

[React] 로그인/로그아웃 유지하기 ( sessionStorage, localStorage)

header {(sessionStorage.getItem("isLogin") === null) ? 로그인 : 로그아웃 } login if(this.state.studentId && this.state.password) { axios.post("/logIn", { studentId: this.state.studentId, password: this.state.password }) .catch(function(error){ alert("학번 또는 비밀번호를 다시 확인해주세요."); }) .then((response) => { let id = response.data.studentId; let pw = response.data.password; console.log(id, pw); if(id === this...

[React / Spring] 리액트에서 스프링으로 데이터 전송

아래 링크의 회원가입 데이터 전달 기준으로 설명 Vo, DAO, Service는 다 작성되었다고 가정 [회원가입] 1. 만들기 Email address We'll never share your email with anyone else. Password Check Password Submit 참고 https://react-bootstrap.github.io/forms/overview/ 2. state 추가 input에 작성된 값을 받기.. wldwlddl59.tistory.com React 1. 아래 명령어 입력해 설치 npm install axios --save npm install http-proxy-middleware --save 2. import axios from 'axios' 추가 3. 값 넘길..

[React] 회원가입

1. 만들기 Email address We'll never share your email with anyone else. Password Check Password Submit 참고 https://react-bootstrap.github.io/forms/overview/ 2. state 추가 input에 작성된 값을 받기 위해서 state 추가가 필요하다. constructor(props) { super(props); this.state = { email: "", password: "", checkPw: "" }; } 3. handleChange 함수 추가 input 필드에서 작성된 데이터를 state에 넣어주는 과정 [name] : 객체 안에서 key를 []로 감싸면, [] 안의 값이 가리키는 실제 값..