When you want to do something in response to a signal changing, you can use the
creeateEffect primitive.
Effects come with the following benefits:
Basically, as long as the scope has access to a signal Accessor the usage is valid.
In this example, we utilize the createEffect to set the isEven signal value
when getCount is updated.
You can nest createEffect within the native React effect when you need to access
the React component render lifecycle.
createEffect accepts a callback Function and returns a Function. When the
return Function is called, it will unsubscribe the effect from the signal Observer.
Important: be sure to use Accessor getters not values within a createEffect
primitive. Ignoring to do so will cause stale values that will not be updated.
Count: 0
Double Count: 0 is even