---
title: "Discussion on \"Always Use a Custom Hook for Context API, Not useContext (React Context API, TypeScript)\" | Hashnode"
description: "Discussion on \"Always Use a Custom Hook for Context API, Not useContext (React Context API, TypeScript)\". https://youtu.be/I7dwJxGuGYQ\n \nStep 1: Create the Theme Context\nFirst, we need to create the context for our theme.\nimport React, { createContext, useState } from 'react';\n\ntype Theme = 'dark' | 'light';\ntype ThemeContextProps = {\n  theme: Theme;\n  s..."
url: "https://hashnode.com/posts/always-use-a-custom-hook-for-context-api-not-usecontext-react-context-api-typescript/64d8b9b4603bcfdcca3bf040"
---

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

Discussion

# [Always Use a Custom Hook for Context API, Not useContext (React Context API, TypeScript)](https://jason60810.hashnode.dev/always-use-a-custom-hook-for-context-api-not-usecontext-react-context-api-typescript?utm_source=hashnode&utm_medium=feed)

https://youtu.be/I7dwJxGuGYQ Step 1: Create the Theme Context First, we need to create the context for our theme. import React, { createContext, useState } from 'react'; type Theme = 'dark' | 'light'; type ThemeContextProps = { theme: Theme; s...

Aug 13, 2023 · 2 min read · jason60810.hashnode.dev  
Read the article

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

## Written by

[Jason Chen](https://hashnode.com/@jason60810)

@jason60810

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

Nothing is true, everything is permitted.

Nothing is true, everything is permitted.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
