
🙌 소개
React.js
를 이용한 인스타그램 클론CRA(create-react-app)
를 사용한 초기 세팅Git
을 사용한 팀 협업 과정MockData
를 이용하여 UI 구현 후componentDidMount()
와fetch()
를 이용해 백엔드와의 통신- Code refactoring
🎉 프로젝트 기간
- 2020.08.31 ~ 2020.09.11
🛸 사용 기술
React
JavaScript
SASS
Git
🚀 구현 기능
로그인 페이지


- 슬라이드
fade-in / fade out
- 유효성 검사 확인
withRouterHOC
로 페이지 이동 구현 -this.props.history.push('/signup')
- 서버와의 통신
fetch()
- media query를 이용한 반응형 구현
MockData
와map()
을 활용해 sitemap 구현
메인 페이지


- 댓글 추가 / 삭제 / 좋아요 기능
- 유저 검색 기능
- 유저 아이콘 클릭 시 서브 메뉴 토글
Mockdata
와map()
을 활용하여 컴포넌트 활용- media query를 이용한 반응형 구현
✍ 기억하고 싶은 코드
1constructor() {2 super();3 this.state = {4 isChecked: false,5 id: '',6 password: '',7 };8 }910 goToMain = () => {11 const { isChecked, id, password } = this.state;1213 isChecked &&14 fetch('http://3.34.133.239:8000/account/signin', {15 method: 'POST',16 body: JSON.stringify({17 email: id,18 password: password,19 }),20 })21 .then((response) => response.json())22 .then((result) => {23 if (result.Authorization) {24 localStorage.setItem('token', result.Authorization);25 this.props.history.push('/main-wontae');26 } else if (result.message === 'UNAUTHORIZED') {27 alert('이메일 / 비밀번호를 확인해주세요');28 }29 });30 };3132 saveData = (e) => {33 const { name, value } = e.target;34 this.setState(35 {36 [name]: value,37 },38 this.checkValidation39 );4041 if (e.key === 'Enter') {42 this.goToMain();43 }44 };4546 checkValidation = () => {47 const { id, password } = this.state;48 const isChecked = id.includes('@') && password.length >= 5;49 this.setState({50 isChecked,51 });52 };5354 render() {55 retrun (56 ...57 <div onKeyUp={this.saveData} className="form">58 <input59 name="id"60 type="text"61 placeholder="전화번호, 사용자 이름 또는 이메일"62 />63 <input name="password" type="password" placeholder="비밀번호" />64 <button65 type="submit"66 className={isChecked ? 'isActive' : null}67 onClick={this.goToMain}68 >69 로그인70 </button>71 </div>72 ...73 )74 }
- 비구조화 할당으로 가독성 높이기
fetch()
함수로 서버와의 데이터 통신className
의 동적인 사용- 명확한 함수, 변수, 클래스 이름
Input
의 name과 계산된 속성명(computed property names)
이용하기