#what does "use" mean?

6 messages · Page 1 of 1 (latest)

upper cliff
#

Solid uses the "use" prefix for some of it's stuff, including useLocation or useMatch

"use" is used in react to communicate that a function is a hook, and can only be used at the top-level of a component to manage state / trigger rerenders.

if use was supposed to signify something as reactive, signals and memos should using it, but they don't.

so what does this even mean in the case of solid?

as a side note, I do think that similar to how svelte uses $ to note something as reactive, solid is missing some easily scannable syntax to find which functions or signals are reactive and are treated specially.

misty thorn
#

create* means to create something in the system (an effect, a signal, a memo, a context), while use means to do something with something that already exists (for example, useContext hooks into the context created with createContext)

#

Similarly, useLocation is meant to "watch" the location (which exists independently) for changes

#

Not sure about useMatch

upper cliff
#

Interesting, so what is the difference between watching for changes with something like useLocation and createMemo, as well as just functions for deriving signals
I'm struggling to understand why use needs to exist.

p.s: dont worry about the date

misty thorn
#

The difference is merely a convention based on the source of the changing data