Explorar o código

132486 add comment why use useEffect

soumaeda %!s(int64=2) %!d(string=hai) anos
pai
achega
cbd62a5cd6
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      apps/app/src/components/PageTags/TagEditModal.tsx

+ 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 {