-
-
Notifications
You must be signed in to change notification settings - Fork 22
Switch from react
to preact
#285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces React with Preact in the ReactPy-Django client, updates build and dependency configurations, and adjusts related code and tests for Preact compatibility.
- Configure TypeScript and package aliases so “react” and “react-dom” resolve to Preact/compat
- Refactor mounting and component utilities to use Preact’s
render
,createElement
, and hooks - Update test utilities to simplify console logging and ignore print statements via ruff
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
tests/test_app/tests/utils.py | Removed custom logging helper, replaced with inline print for Playwright console events |
src/js/tsconfig.json | New TS config enabling Preact JSX, path aliases for React imports |
src/js/src/mount.tsx | Swapped out ReactDOM.render for preact.render , added guard for missing mount element |
src/js/src/components.ts | Replaced React imports with Preact equivalents in bind , DjangoForm , and HttpRequest |
src/js/src/client.ts | Switched ReactPyClient /ReactPyModule imports to type-only |
src/js/package.json | Added preact and aliased react /react-dom to Preact, updated dev dependencies |
Comments suppressed due to low confidence (2)
src/js/package.json:9
- [nitpick] Since the codebase now uses Preact instead of React, consider removing
eslint-plugin-react
or switching to a Preact-compatible ESLint plugin to avoid false lint errors.
"eslint-plugin-react": "^7.37.1",
src/js/tsconfig.json:14
- The compiler option
module: "Preserve"
is not a valid module target in TypeScript. Consider using a supported value such as"ESNext"
or your desired module format.
"module": "Preserve",
Description
Removes usage of
react
from the reactpy-djangoclient
and utilizepreact
instead.This also required doing some overrides to force
@reactpy/client
to utilizepreact
.Checklist
Please update this checklist as you complete each item:
By submitting this pull request I agree that all contributions comply with this project's open source license(s).