From 2ad2dbc69ec694d7dde33edce6f2ef08af6edc62 Mon Sep 17 00:00:00 2001 From: CuriousCorrelation Date: Wed, 13 Jul 2022 15:51:31 +0530 Subject: [PATCH] Move mount `useEffect` to top, convention --- app/components/FilterOptions.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/FilterOptions.tsx b/app/components/FilterOptions.tsx index e92a0125b4..ddfb2bca26 100644 --- a/app/components/FilterOptions.tsx +++ b/app/components/FilterOptions.tsx @@ -44,6 +44,10 @@ const FilterOptions = ({ }); const [filteredData, setFilteredData] = React.useState([]); + React.useEffect(() => { + setFilteredData(options); + }, [options]); + const selected = options.find((option) => option.key === activeKey) || options[0]; @@ -70,10 +74,6 @@ const FilterOptions = ({ [clearFilter, options] ); - React.useEffect(() => { - setFilteredData(options); - }, [options]); - return (