Skip to content

Question about Contexts & Hooks #3

@r002

Description

@r002

Thank you, @neurodynamic, for putting this site together. Loving React so much more since the introduction of hooks! I've been learning more about context and hooks and specifically, on:

https://reactwithhooks.netlify.app/docs/context.html#updating-context-from-a-nested-component,

image

is this the only way to pass the toggleTheme function down to all children? To set up another context? It just seems having to set up multiple providers (one for being the theme and one for changing the theme) feels awfully clunky.

Is there any better way to just put all theme-related functionality (defining and toggling) into a single context?

PS. A big thanks to armenic. That's how I found this website!

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