Skip to content

Suggestion: Context for state instead of mutating a prop #148

@bn-l

Description

@bn-l

At the moment because the svelte component that calls this library "owns" the TableHandler instance, and it's supplied as a prop to the various table components, when updating sort or filter etc., the props are mutated in the children and there's a warning (in dev) that you "shouldn't mutate what you don't own" (link to docs).

Could the state of sort, filter etc be in the context on the top level datatable component using the getContext and setContext api? I really like way it's done in this reddit post: https://www.reddit.com/r/sveltejs/comments/1gzyv2h/comment/lz08wnm/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions