kalkronline
kalkronline

Reputation: 743

Can I use the $store syntax directly on an object's property?

I have an object with a Writable property. Is there a way to use the $store syntax directly with object.property, or am I going to have to give the store its own name?

<script lang="ts">
    export let motor: Motor;
    //  {
    //      profile: Writable<string>
    //  }

    console.log($motor.profile)   // nope
    console.log(motor.$profile)   // nope
    console.log($(motor.profile)) // nope

    let { profile } = motor;
    console.log($profile);        // sure
</script>

Upvotes: 0

Views: 60

Answers (1)

Mohamed Elgazar
Mohamed Elgazar

Reputation: 794

There is no way to use the $store syntax directly with object.property. You will have to give the store its own name.

Upvotes: 2

Related Questions