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