Skip to content

Commit

Permalink
refactor: decrease code nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
jsapro committed Jan 6, 2024
1 parent a334498 commit b993f39
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/pages/product/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const Product: React.FC = () => {
const { id } = useParams();

useEffect(() => {
if (productItem !== null) {
const translatedMeasureObj = translateMeasureUnit(
productItem.measure_unit,
productItem.amount
);
setMeasureObj(translatedMeasureObj);
}
if (productItem === null) return;

const translatedMeasureObj = translateMeasureUnit(
productItem.measure_unit,
productItem.amount
);
setMeasureObj(translatedMeasureObj);
}, [productItem]);

useEffect(() => {
Expand Down

0 comments on commit b993f39

Please sign in to comment.