Open cossack910 opened 1 year ago
json
https://jsonplaceholder.typicode.com/comments
interface
interface CommentType {
postId: number;
id: number;
name: string;
email: string;
body: string;
}
axios
axios
.get<Array<CommentType>>("https://jsonplaceholder.typicode.com/comments")
.then((res) => {
setComment(res.data);
})
.catch(() => {
console.log("error");
});
install
types無しで型提供あり。