Updating State does not rerender when calling a method on my class

I am setting a state with new FileSystem() After calling the createDirectory method which adds a new child directory to the current directory of the file system object it does not rerender the component. const [fs, setFS] = useState<FileSystem>(new FileSystem()); useEffect(() => { fs.createDirectory("first dir"); setFS(() => fs); }, []);
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
cje
cje2y ago
Don’t post it then lmao
deforestor
deforestor2y ago
to be fair, it looks like it is lol
benten
benten2y ago
Yeah you're just passing back the same fs object Store fs in a ref and setState somewhere else
Want results from more Discord servers?
Add your server