TanStack / TanStack/router

Error when using Shadcn Button in Server Components

Open
#7,236 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Start

Describe the bug

When using a Shadcn Button in a component rendered using renderServerComponent there is an error:

React.createContext is not a function
Your Example Website or App

https://github.com/josefbender/rsc-shadcn-button-error

Steps to Reproduce the Bug or Issue
  1. Create a component using Button from shadcn/ui with Radix
  2. Render the component using renderServerComponent (eg. in a server function)
  3. See error: React.createContext is not a function
Expected behavior

That the Button can also be rendered on the server.

Screenshots or Videos

No response

Platform
  • Router / Start Version: 1.167.4 / 1.166.15
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 147.0.7727.56
  • Bundler: vite
  • Bundler Version: 7.3.1
Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction at josefbender/rsc-shadcn-button-error and reproduce the failure using renderServerComponent with a shadcn/ui Button and Radix. Compare the behavior on the listed Router and Start versions with the expected result: the Button renders on the server without React.createContext errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vite
Domain
frontend, full-stack
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.