Skip to content

Commit

Permalink
feat : add hooks/useGetProfitTomorrow.js (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
JungYeonHwi committed Oct 23, 2023
1 parent d2f89fb commit b84b1c9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hooks/useGetProfitTomorrow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useEffect, useState } from "react";
import predictionService from "services/prediction.service";

const useGetProfitTomorrow = (id) => {
const [data, setData] = useState("");

useEffect(() => {
const getProfitTomorrow = async() => {
if (id !== undefined) {
const fetchData = await predictionService.getProfitTomorrow(id);
setData(fetchData);
}
}

getProfitTomorrow();
}, [id]);

return data;
}

export default useGetProfitTomorrow;

0 comments on commit b84b1c9

Please sign in to comment.