Skip to content

Missing example for keyless context created with createContext() #474

@andyearnshaw

Description

@andyearnshaw

The context examples only cover the basic getContext() and setContext() API. There's no example for the type-safe createContext() API:

import { createContext } from 'svelte';

export const [getUserContext, setUserContext] = createContext<User>();

These context functions don't use a key, so the context: Map([[<key>, <value>], ...]) approach doesn't seem to be appropriate. I'm just getting to grips with Svelte testing, so I'm not sure how to do this myself yet. If I figure it out then I may open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions