I'm managing states outside of svelte and changing all my writable things to $state while i'm trying svelte5 alpha.
as i understood, $state is available globally, not specific .svelte files
my mental model for $state is writable or solid's signal things.
i don't know reason because $state in class at svelte file is perfectly works.
do i need addtional steps to solve this issue?
Error Message
ReferenceError: $state is not defined
Reproduction
--TS
export default class AuthState {
+ status = $state<IAuthState['status']>('logout')
+ from = $state<IAuthState['from']>()
- REMOVED any Writable things
constructor(protected state: IAuthState) {
this.status = state.status
this.from = state.from
}
--Svelte
<script>
// Using getContext to bring my auth class here
</scirpt>
<div>
{status}
{from?.data.email}
{from?.data.at}
</div>
Describe the bug
I'm managing states outside of svelte and changing all my writable things to $state while i'm trying svelte5 alpha. as i understood, $state is available globally, not specific .svelte files my mental model for $state is writable or solid's signal things. i don't know reason because $state in class at svelte file is perfectly works. do i need addtional steps to solve this issue?
Error Message
ReferenceError: $state is not defined
Reproduction
Logs
No response
System Info
Severity
annoyance