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