question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Why are you using Solid's createMutable?

See original GitHub issue

I wasn’t sure if I should open an issue about this but I saw that you are using Solid’ createMutable which is not recommended and is intended mostly for easier transition from libraries with similar APIs. Other than not having read and write segregation it also leads to over subscription. Maybe you guys are aware of that already, just wanted to make sure.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
trusktrcommented, Aug 2, 2022

It is totally conceivable people can write all their state variables using createSignal (the fastest option), so outputting that would be totally fine. f.e.

const [foo, setFoo] = createSignal(...)
const [bar, setBar] = createSignal(...)
const [baz, setBaz] = createSignal(...)
// ...etc...

Maybe less ergonomic than stores in various cases, but still legitimate and still an idiomatic option

1reaction
steve8708commented, Jul 25, 2022

Should we not just use signals? What’s the downside to the most simple/idiomatic approach used in solidjs’s docs? Everything else here sounds more complex and deviates from the idea of “generate code just like a developer would write” for a given framework

We should be able to just reuse all of our react hooks logic, just make sure all reads add a (), so not list but list() in the code, which is a normal sort of thing we do for other output types

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mention gotchas regarding createMutable #149 - GitHub
I use it for internal state in my components because the dev experience is far better than having to write setter calls to...
Read more >
State Management in SolidJS Applications - HackerNoon
State management for SolidJS applications with signals and stores. Do you need a state library like Redux or MobX for your SolidJS app?...
Read more >
A few reasons why I love Solid.js - DEV Community ‍ ‍
Solid is very modular: one can use its reactive primitives while skipping out on declarative templating (for example) to create a reactive state ......
Read more >
If immutable objects are good, why do people keep creating ...
Most developers create mutable objects because mutability is the default in imperative ... There are some things you simply can't do with immutable...
Read more >
how do I make granular signals that works for properties of a ...
One way you can do it is like this: import {createMutable} from 'solid-js/store' import {createEffect} from 'solid-js' class Foo { // any ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found