From 353581c81e579a09952a827344fe841b6071bae9 Mon Sep 17 00:00:00 2001 From: youxingzhi Date: Sat, 11 May 2024 18:43:09 +0800 Subject: [PATCH 1/6] blog-14: add mount_effect and update_effect --- examples/hello-world/src/App.tsx | 4 +- packages/react-reconciler/src/fiber.rs | 5 +- packages/react-reconciler/src/fiber_hooks.rs | 92 +++++++++++++++++-- .../react-reconciler/src/hook_effect_tags.rs | 9 ++ packages/react-reconciler/src/lib.rs | 1 + packages/react-reconciler/src/update_queue.rs | 3 + packages/react/src/current_dispatcher.rs | 10 +- packages/react/src/lib.rs | 6 ++ 8 files changed, 116 insertions(+), 14 deletions(-) create mode 100644 packages/react-reconciler/src/hook_effect_tags.rs diff --git a/examples/hello-world/src/App.tsx b/examples/hello-world/src/App.tsx index f70ebe1..bc52e41 100644 --- a/examples/hello-world/src/App.tsx +++ b/examples/hello-world/src/App.tsx @@ -1,8 +1,10 @@ -import {useState} from 'react' +import {useEffect, useState} from 'react' function App() { const [num, updateNum] = useState(0); + useEffect(() => { + }, []); return (