ENG-6503: use react-router Link instead of rx.el.a#5529
Merged
Conversation
React Router's Link is a thin wrapper over the plain A element, with client-side routing support. It internally detects absolute links (even those given by a Var at runtime), so there's no good reason why it shouldn't be used. If downstream users really want the plain link, they can get it through `rx.el.elements.a` or `rx.el.A.create`, but the use case should be quite rare. Updates to lazy_loader to allow overriding the returned `__all__` with extra imports that are not in the submodules or submod_attrs.
Contributor
There was a problem hiding this comment.
PR Summary
Major architectural change replacing standard HTML anchor tags with React Router's Link component for optimized client-side routing across the Reflex framework.
- Added new
reflex/components/react_router/dom.pyimplementing ReactRouterLink component with intelligent handling of internal/external links - Modified
reflex/components/radix/themes/typography/link.pyto use ReactRouterLink as the default link component - Updated
reflex/utils/lazy_loader.pyto support additional all attributes for component exposure - Modified
reflex/components/el/__init__.pyto filter out basic 'a' tag in favor of React Router Link while maintaining backward compatibility - Added React Router integration in
reflex/components/__init__.pywith proper lazy loading support
7 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile
|
|
||
| from .dom import ReactRouterLink | ||
|
|
||
| link = ReactRouterLink.create |
Contributor
There was a problem hiding this comment.
style: Consider adding type hints here for better IDE support and type safety: link: Callable[..., Component] = ReactRouterLink.create
CodSpeed Performance ReportMerging #5529 will not alter performanceComparing Summary
|
adhami3310
approved these changes
Jul 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
React Router's Link is a thin wrapper over the plain A element, with client-side routing support. It internally detects absolute links (even those given by a Var at runtime), so there's no good reason why it shouldn't be used.
If downstream users really want the plain link, they can get it through
rx.el.elements.aorrx.el.A.create, but the use case should be quite rare.Updates to lazy_loader to allow overriding the returned
__all__with extra imports that are not in the submodules or submod_attrs.