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 User3y ago
Message Not Public
Sign In & Join Server To View
cje
cje3y ago
Don’t post it then lmao
deforestor
deforestor3y ago
to be fair, it looks like it is lol
benten
benten3y ago
Yeah you're just passing back the same fs object Store fs in a ref and setState somewhere else

Did you find this page helpful?