From 93f969216692f9a35ede5386e582a5f0b13428b2 Mon Sep 17 00:00:00 2001 From: David Mota <83174541+davidsilvamota@users.noreply.github.com> Date: Tue, 2 Aug 2022 10:38:51 -0300 Subject: [PATCH] change useeffect to not be async --- src/ShapeFile.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ShapeFile.js b/src/ShapeFile.js index 7e96864..980ad1d 100644 --- a/src/ShapeFile.js +++ b/src/ShapeFile.js @@ -6,8 +6,11 @@ const ShapeFile = (props) => { const [ geoJSONData, setGeoJSONData ] = useState(null) const { data, ...geoJSONProps} = props - useEffect(async () => { - setGeoJSONData(await shp(props.data)) + useEffect(() => { + const parseData = async () => { + setGeoJSONData(await shp(props.data)) + } + parseData(); }, [props.data]) return ( @@ -16,4 +19,4 @@ const ShapeFile = (props) => { } -export default ShapeFile \ No newline at end of file +export default ShapeFile