20220608

권도토잠보·2022년 6월 7일
0

Project_ ThirdBlood

목록 보기
2/3
post-thumbnail

프로젝트 난바 쓰리

타입스크립트니까 타입을 지정해줘야한다.

🦭 에러가 메우 친절하다 호옹이

🦭 아니 Inputref.current.focus();코드를 넣어줬는데 어째서 회원가입 버튼이 활성화 되는건뒈 !

🦭 엇


const onSubmit = useCallback(
    (e: any) => {
      if (email.length < 1) {
        e.preventDefault();
        Inputref.current.focus();
        return;
      } else {
        e.preventDefault();
        console.log('------------------로그인 확인', email, nickname, password, passwordCheck);
        if (!missmatchError) {
          console.log('에러따위 없소 ! 서버로 회원가입가기 전송해도 될듯하오');
        }
      }
    },
    [email, nickname, password, passwordCheck, missmatchError],
  );

이렇게 코드를 다시 수정하였다.

🦭 재랜더링 안되쥬? 응 회원가입 입구컷 안돼 돌아가

그나저나 타입지정 왜 이렇게 어려워


type ReturnType<T = any> = [T, (e: any) => void, Dispatch<SetStateAction<T>>];

const useInput = <T = any>(initiaData: T): ReturnType<T> => {

  // 중략
  
  return [value, handler, setValue];
};

🦭 원래 이렇게 어려운건가 ? 아님 내가 어려워하는건가 ? 뭔데 !

배움++

타입스크립트이니까 타입지정해줘야지..

Cookies are like local storage. But cookies get sent between server and client no matter what. It's a big json object. You normally send them in the backend and set in front. But it's just data you can use on both front/back for communication.

Sessions are data that gets stored only on the backend. The browser only holds the session ID. The ID gets used do when you're right jser, you have access to all that data held on the server.

But json web tokens (JWT) is pretty much the opposite. You securely store all of the data on the client.

That's how apps like Kakao and slack work. We have a JWT on our phone and pc at the same time. And we logged in securely with our passwords to authenticate.

Sessions, since they only exist on the server, need a new one for each device and instance
Cache, is just an HTTP option / server option. It just means to store data in middleware or fast storage so we can get it without querying the database and stuff.
Usually with all of this. You have an "expiration". That tells any of it how long to store the cached data, JWT or session before closing it out and deleting it.
That's how bank apps normally work. They use a session. So if a new session ever happens. All devices will log out. They only want to have one working.

Luckily I saw you're using passport. Passport (the user auth package in your backend) will handle a lot of this.

This is just what it's doing under the hood lol.

이상 쿠키 세션 캐시 존왓턍에대한 설명인데.... 아직도 뭐라는지 알 수 없을 무

반성++

HTML 태그속성 공부 필요
영어공부필요

오늘의 한줄요약

아 타입스크립트 친해지자 나랑제발


Gaen Naia Kyri Vi

profile
낯선이여, 당도하였으면 당도높은 복숭아

0개의 댓글