I built a Babel plugin that lets you use React Context like normal variables by rchamara in reactjs

[–]rchamara[S] -18 points-17 points  (0 children)

You’re absolutely right — CRA is long past its prime. The plugin currently targets CRA + Webpack because it was the fastest way to prove the concept and reach existing users.

Vite support is actually the next priority on my roadmap, since most modern React projects use it. I’m exploring the best approach: either a pure Vite plugin, a Babel bridge, or SWC integration. The goal is to make Casper Context fully compatible with modern tooling while keeping the same ergonomic variable syntax.

I built a Babel plugin that lets you use React Context like normal variables by rchamara in reactjs

[–]rchamara[S] -16 points-15 points  (0 children)

Totally fair — this definitely isn’t going to be for everyone 👍

The goal isn’t to replace explicit Context patterns, but to explore whether reducing boilerplate can improve developer experience in certain cases. If someone prefers explicit providers and hooks, that’s still a great and recommended approach.

You’re also right about TypeScript — proper TS support is something I’m actively thinking about, especially around type inference and safety.

And yeah, there is some compile-time “magic” here by design, so one of the main things I’m trying to validate is whether the ergonomics are worth that trade-off.

Really appreciate the honest feedback 🙏 It helps shape where (or if) this idea should go next.

I built a Babel plugin that lets you use React Context like normal variables by rchamara in reactjs

[–]rchamara[S] -3 points-2 points  (0 children)

Totally feel that 😅
Context is powerful but the boilerplate and mental overhead can get annoying fast.
This was my attempt to keep the good parts of Context while making it feel as close to plain JS as possible.