---
title: "Discussion on \"React basics: explaining the useContext hook\" | Hashnode"
description: "Discussion on \"React basics: explaining the useContext hook\". Sometimes we have data that we need to access in almost all parts of our components.\nIt will become a hassle to pass them down to each component, exactly where context comes in.\nIn this example, I'll use a specific theme for a website.\nOur website ha..."
url: "https://hashnode.com/posts/react-basics-explaining-the-usecontext-hook/616bbc0cb636526db5f48ad1"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [React basics: explaining the useContext hook](https://h.daily-dev-tips.com/react-basics-explaining-the-usecontext-hook?utm_source=hashnode&utm_medium=feed)

Sometimes we have data that we need to access in almost all parts of our components. It will become a hassle to pass them down to each component, exactly where context comes in. In this example, I'll use a specific theme for a website. Our website ha...

Oct 17, 2021 · 4 min read · h.daily-dev-tips.com  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Chris Bongers](https://hashnode.com/@dailydevtips)

@dailydevtips · Cape Town, SA

  
[View profile](https://hashnode.com/@dailydevtips)

Looking to get into development? As a full-stack developer I guide you on this journey and give you bite sized tips every single day 👊

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.

## Responses 1

Markdown supported · ⌘↵ to post

[Jb Rocher](https://hashnode.com/@jibrocher)

[Oct 17, 2021](https://hashnode.com/posts/react-basics-explaining-the-usecontext-hook/616bbc0cb636526db5f48ad1/comment/616bde95441bd36daa95658f)

Nice one ! Something I like to do when creating these kind of providers is to export a custom hook wrapping the call to `useContext`.

For example : `const useTheme = () => useContext(ThemeContext);`

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Oct 17, 2021](https://hashnode.com/posts/react-basics-explaining-the-usecontext-hook/616bbc0cb636526db5f48ad1/comment/616bde95441bd36daa95658f#reply-616c2c3e7c361e5132822b9f)

Very good point, I use this approach most of the time as well. Was just a bit clearer to explain without introducing custom hooks yet.

But super valid point!
