edygar
Problems changing the value of a reactive signal returned from a function
The problem with benchmarks is not what we measure but rather what we miss to measure. xD So besides the CPU time, you should measure the pressure on the GC. Having that said, xD I've no idea, the benchmark I usually do is just the DevTools' ones, Lighthouse+memory snapshots.
51 replies
Problems changing the value of a reactive signal returned from a function
Vanilla is the most optimized way, solid createSignal gets reaaaaaaally close to it, with store you lose just a bit, but when you compare to react, there’s no reason for concerns
51 replies
Problems changing the value of a reactive signal returned from a function
Imagine now you grab a 3rd party component and pass the board as property. If they mutate your board, it will update the screen, but how are you going to reason about it other than looking the component’s code?
51 replies
Problems changing the value of a reactive signal returned from a function
The only downside for createMutable is that in an application, passing around this ref is exposing your state to 3rd party components that my mutate your state without you knowing about it, but that’s on a large scale app
51 replies
Problems changing the value of a reactive signal returned from a function
In general there’s a performance gap in between them both, but let’s be real, the difference is waaaay to small for you to concern, it’s still orders of magnitude faster than React
51 replies
Problems changing the value of a reactive signal returned from a function
It's up to you, but I find it easier to let the store handle the whole matrix, while reading, you are spared from calling the signals such as
board[0]()
, if board was a store, all it would take would be board[0]
. Also, the update function has a lot of useful things like: update members of an array with a filter function; a range and things like that; you can read more on https://docs.solidjs.com/concepts/stores#path-syntax-flexibility51 replies
Problems changing the value of a reactive signal returned from a function
I found createStore to be very convenient for handling these kind nested signals.
Like (sorry, the code is a bit messy) here:
https://github.com/edygar/minesweeper
https://github.com/edygar/puzzle
51 replies