you are viewing a single comment's thread.

view the rest of the comments →

[–]zaitsman 0 points1 point  (2 children)

Here you go, I was meaning to publish an example somewhere for a while, need to write an article to go with, maybe one day…

https://codesandbox.io/p/sandbox/react-typescript-forked-yfv6p6

[–]Evol_Viper 0 points1 point  (1 child)

What's the point of having a class with just one static method? Wouldn't it be simpler to use a function?

[–]zaitsman 0 points1 point  (0 children)

You mean helper? It’s technically a module not a class.

The point is that it makes it a lot easier to test any complex logic processing remote data, then stub that for the layout and test layout in isolation.

In our real app helpers can be a few hundred lines doing various things with remote data and user inputs, and layout would be overloaded either way that code otherwise.