|
|
|
|
|
by Leftium
386 days ago
|
|
For complex things, I came up with a pattern that stores the state externally from the components in a single centralized file. So the components just become simple shells that render the state and forward events. (All the complex business logic can be tested without the DOM/headless browser.) I call it "nation state" because it groups sets of related variables together in a scope between local and global. I implemented the pattern with Svelte runes, but I think it could be implemented with anything; even React. I went into more detail here (with live example/code): https://www.reddit.com/r/sveltejs/comments/1dgf8la/comment/l... |
|
Might be an anti pattern but it works really well.