SolidJSS
SolidJS8mo ago
lemonad

createEffect vs createEffect + on

What could be the reason that the first
createEffect
is triggered but not the second one using
on
? I feel there is something obvious I'm missing. Using solid-js 1.9.5

createEffect(() => {
  console.log("effect", props.nearestPointConfig);
  });

createEffect(
  on(
    () => props.nearestPointConfig,
    (config) => {
      console.log("effect 2", config);


This is the output from the first
console
call:
[Log] effect (Video.tsx, line 95)
Proxy

handler: {get: function, has: function, set: function, deleteProperty: function, ownKeys: function, …}

target: {name: "P1-P2", areas: Array, Symbol(solid-proxy): Proxy, Symbol(store-node): Object}


The prop is a property of a store if that matters:

const [store, setStore] = createStore<GlobalStoreType>({
...
nearestPointConfig: undefined,
});
Was this page helpful?