Skip to content

Commit

Permalink
[fix] localStorage useEffect 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
harin0707 committed May 30, 2024
1 parent 9d63f67 commit caaf8d9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/pages/project/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React ,{useState} from 'react';
import React ,{useState, useEffect} from 'react';
import styled from 'styled-components';
import {useRouter} from 'next/router';
import NewIssue from '@/components/modal/NewIssue';
Expand Down Expand Up @@ -40,6 +40,14 @@ const Issues = () => {


const [isVisible, setVisiable] = useRecoilState(modalState);
const [projectName, setProjectname] = useState<string|null>(null);

useEffect(()=>{
if (typeof window!== 'undefined'){
setProjectname(localStorage.getItem('projectName'));
}

})

const handleModal = ()=>{
setVisiable(true);
Expand All @@ -53,7 +61,6 @@ const Issues = () => {
refetch();
}

const projectName = localStorage.getItem('projectName');


const [isHovered, setIsHovered] = useState(false);
Expand Down

0 comments on commit caaf8d9

Please sign in to comment.