Skip to content

Context API doesn't work for custom elements #3422

Closed
@romangutkin

Description

@romangutkin

When compiling to custom elements, getContext returns undefined

// Select.svelte
import { setContext } from 'svelte'

setContext('select', {
  selected: 'one'
})

// SelectOption.svelte
import { getContext } from 'svelte'

const { selected } = getContext('select') // undefined

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions