Skip to content

Commit

Permalink
🐛fix: StockContent.jsx - 시가 데이터 못 받아오는 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinHeeEul committed Jun 24, 2024
1 parent 0c3cbfc commit 9e71be9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pages/main/contents-item/StockContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function StockContent(props) {
const fetchData = async () => {
try {
const response = await axios.get(
`api/current-price?symbol=${companyCode}`
`/api/current-price?symbol=${companyCode}`
);
setRatePerYesterday(response.data.output.prdy_ctrt);
setsignPerYesterday(response.data.output.prdy_vrss_sign - 3);
Expand All @@ -35,14 +35,17 @@ export default function StockContent(props) {
}
};
fetchData();
}, []);
}, [props.companyCode]);

return (
// !! div에 key값 붙여주세요. (redux 구현 후)
<StyledContentsDiv width={props.width} height={props.height}>
<StyledContentsTitleGroup>
<StyledContentsTitle>{companyName}</StyledContentsTitle>
<StyledContentsMiniTitle signPerYesterday={signPerYesterday}>
<StyledContentsMiniTitle
key={companyCode}
signperyesterday={signPerYesterday}
>
<p>({ratePerYesterday}%)</p>
{signPerYesterday > 0 ? (
<p></p>
Expand Down

0 comments on commit 9e71be9

Please sign in to comment.