Skip to content

Conversation

@VsangkyeongV
Copy link
Contributor

No description provided.

인라인 스타일 적용이 안됩니다 ㅠㅠ
일단 데이터만 받았습니다
Copy link
Contributor

@DeveloperRyou DeveloperRyou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4주차 과제도 잘 진행해주셨고, 캐러셀 부분 작업중이시다면 pr 주시면 피드백 드리겠습니다!

Comment on lines +10 to +22
const [posts, setPosts] = useState<NoticeCardInterface[]>([]);
useEffect(() => {
axios
.get("https://jsonplaceholder.typicode.com/posts")
.then((response) => {
setPosts(response.data);
console.log("success!", response.data);
})
.catch((error) => {
console.log("some errors", error);
});
}, []);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  const [posts, setPosts] = useState<NoticeCardInterface[]>([]);
  useEffect(() => {
    async function getData() {
      try {
        const response = await axios.get("https://jsonplaceholder.typicode.com/posts");
        setPosts(response.data);
        console.log("success!", response.data);
      }
      catch(error) {
        console.log("some errors", error);
      });
    }
    getData();
  }, []);

이런식으로 진행할 수 있을 것 같습니다!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 이런식으로 진행하면 나중에 좋은점이, getData같은 함수를 따로 빼서 관리할 수 있게 됩니다! axios 요청하는 함수를 따로 파일로 관리할 수 있게 되어 유지보수가 수월해 지겠죠

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

캐러셀은 알려주신 slick라이브러리 사용해서 잘 마무리 했습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants