Przeglądaj źródła

132486 add comment why use useEffect

soumaeda 2 lat temu
rodzic
commit
cbd62a5cd6

+ 3 - 0
apps/app/src/components/PageTags/TagEditModal.tsx

@@ -25,9 +25,12 @@ export const TagEditModal: React.FC = () => {
   const updateStateAfterSave = useUpdateStateAfterSave(pageId);
 
   const [tags, setTags] = useState<string[] | undefined>(initTags);
+
+  // use to take initTags when redirect to other page
   useEffect(() => {
     setTags(initTags);
   }, [initTags]);
+
   const handleSubmit = useCallback(async() => {
 
     try {