gitHub : https://github.com/leeyulgok/5-Day2
공식 홈페이지 : https://firebase.google.com/docs?authuser=0&hl=ko
- 실시간 데이터베이스 : 실시간으로 데이터를 동기화할 수 있는 JSON 기반의 클라우드 데이터베이스.
- 인증 : 사용자 인증을 간편하게 처리.
- 호스팅 : 정적 웹 페이지를 호스팅하기 위한 간단하고 안정적인 웹 호스팅 서비스를 제공
- 스토리지 : 사용자가 업로드한 파일(이미지, 동영상 등)을 저장하고 관리.
- 클라우드 메시징 : 애플리케이션 사용자에게 푸시 알림을 보낼 수 있는 기능을 제공.
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import {
getAuth,
createUserWithEmailAndPassword,
signInWithEmailAndPassword,
onAuthStateChanged
} from "firebase/auth";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
""
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
export { createUserWithEmailAndPassword, signInWithEmailAndPassword, onAuthStateChanged};
export default auth;
https://firebase.google.com/docs/auth/web/start?hl=ko&authuser=0
import { useEffect, useState } from "react";
import auth, {
createUserWithEmailAndPassword,
signInWithEmailAndPassword,
onAuthStateChanged,
} from "../firebase/firebaseConfig";
import Home from "./Home";
const Auth = ({ isLoggedIn }) => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
useEffect(() => {
auth.onAuthStateChanged((user) => {
if (user) {
setLoginState(true);
} else {
setLoginState(false);
}
setBtnToggle(true);
});
}, []);
const onChange = (event) => {
const {
target: { name, value },
} = event;
if (name === "email") {
setEmail(value);
} else if (name === "password") {
setPassword(value);
}
};
const onSubmit = async (event) => {
event.preventDefault();
try {
let data;
if (회원가입 || 로그인) {
data = await createUserWithEmailAndPassword(auth, email, password);
} else {
data = await signInWithEmailAndPassword(auth, email, password);
}
} catch (error) {
console.log(error);
}
};
};
export default Auth;
본 후기는 유데미-스나이퍼팩토리 10주 완성 프로젝트캠프 학습 일지 후기로 작성 되었습니다.
#프로젝트캠프 #프로젝트캠프후기 #유데미 #스나이퍼팩토리 #웅진씽크빅 #인사이드아웃 #IT개발캠프 #개발자부트캠프 #리액트 #react #부트캠프 #리액트캠프
근데 너꺼 보면 진짜 열심히 잘쓴다;;
뭔가 이뻐 정리도 잘됐고