Allow React support to be optional
See original GitHub issueIt would be nice if React support was optional, such that if you didn’t want to use it, the dependencies aren’t downloaded. Currently, the entire React library is imported whether or not you want to use it, which might not be ideal for something like a pure API.
It could be done by allowing React to be added in manually by importing something like react.ts (which would be next to main.ts) and using its exports, or by allowing React to be imported by the consumer and then provided to the API (this would allow users to select a specific version of React as well, or maybe even be able to use Preact).
I’m not sure on the best way to implement it, but if this is something worth looking into, I’d be happy to try and write up a PR!
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Enabling optional chaining in a create-react-app
In this post, we'll learn how to enable optional chaining in an application created using create-react-app. This is probably not something that should...
Read more >How to enable optional chaining with Create React App and ...
Create-React-App uses babel to transpile the TypeScript so it isn't using your npm installed version of TypeScript.
Read more >Optional chaining with React - DEV Community
The main advantage of using optional chaining is a smaller and cleaner code which makes it easier to comprehend once people get used...
Read more >Optional chaining with React and TypeScript | Building SPAs
Optional chaining is a cracking new JavaScript feature that we can use today in React and TypeScript apps. What is this feature, and...
Read more >Start Using Optional Chaining and Nullish Coalescing in React
The optional chaining operator ( ?. ) enables you to read the value of a property located deep within a chain of connected...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m going to open an issue for middleware since it seems a bit out of scope for this issue (and I wanted to suggest a possible API for it)
Having thought about this for a few days, here’s what I’ve decided:
peerDependencies. For that, I will accept a PR that adds areactserver option, which can be used to override the built-in version that ships with the framework. However, I would encourage users to use an import map instead, so that only one React is ever downloaded. PR welcome for documenting how to do that.I’m happy to revisit this approach in the future. In particular, if Deno’s tooling around peer dependencies improves, that may open up new opportunities for us.