Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
6 replies
codefork

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);
}, []);
Was this page helpful?