reactive-python / reactpy-router Goto Github PK
View Code? Open in Web Editor NEWA URL router for ReactPy
Home Page: https://reactive-python.github.io/reactpy-router
License: MIT License
A URL router for ReactPy
Home Page: https://reactive-python.github.io/reactpy-router
License: MIT License
Currently is impossible to hijack idom-router
internals to utilize something like Django's URL routing schema.
We need some kind of way of configuring this behavior.
For example, within idom-router.conf
perhaps there is a global called ROUTING_ENGINE: Callable
.
The interface for this callable is up for debate.
Add a Form
component a la react router's.
For event driven applications, such as auth, it is useful to be able to dynamically route to different paths
@component
def example():
...
def click_event(e):
resp = ...
if resp.status == 501:
# Redirect to /login_incorrect
elif resp.status == 200:
# Redirect to /login_successful
else:
# Redirect to /login_error
...
In JavaScript this is fairly easy, since JS has direct control over the client.
This feature might use our future use_messenger
hook to handle redirection events.
Back and Forward don't re-render the page, which causes stuck on last render.
Currently, the readme doesn't mention how to set this up.
I see there is a bind
function, but there's no usage information.
We need to put some quick documentation into the readme on usage of idom-router.
This function needs to match the react-router
equivalent.
See #2 for more details.
This hook needs to match the react-router
equivalent.
See #2 for more details.
The following works:
link('Users', to='/users')
When I replace 'Users' with a html composite, eg:
button = html.button({'class_name': '...'},
icon(),
html.span({'class_name': ...'}, 'Users')
)
link(button, to='/users')
The button composite is rendered as an empty <div></div>
. The button composite renders correctly outside the link.
Right now, if you click the browser's back button, the page does not update. We need to subscribe to changes in browser history and send them to the sever. I'm not really sure how best to achieve this in the long run. In the short run, I think this may require creating a hidden JS component that we display at the level of the router that does this.
Currently, URL routes cannot be resolved within IDOM.
Add support for URL routing within IDOM core.
Add React-Router
into IDOM core.
Here an example on how this can be implemented
def route_component():
http.browser_router(
http.route("/"),
http.route("path_1/"),
http.route("path_2/")
)
And here's a reference video on explaining react-router.
BrowserRouter
Route
regex: bool = False
to allow for regex routes?Link
prevent_default
pre-appliedregex: bool = False
to allow for regex linksuseHistory
useLocation
useParams
useMatch
Routes
(formerly Switch
)
match_all=False
kwarg within browser_router
NavLink
Redirect
MemoryRouter
StaticRouter
Prompt
This hook needs to match the react-router
equivalent.
See #2 for more details.
Describe the bug
ctrl+click
does not open links in a new tab.
To Reproduce
from reactpy import component, html, run, use_location
from reactpy_router import link, route, simple
@component
def root():
use_location()
return simple.router(
route(
"/",
html.div(
html.h1("Home Page ๐ "),
link(html.button("About"), to="/about"),
),
),
route("/about", html.h1("About Page ๐")),
)
Then ctrl+click
the link and note that the current page navigates to the link.
Expected behavior
The link should open in a new tab.
We need to follow our own naming conventions of avoiding CamelCase when possible.
This will probably involve renaming Route
-> _Route
then using route = _Route
.
This hook needs to match the react-router
equivalent.
See #2 for more details.
This hook needs to match the react-router
equivalent.
See #2 for more details.
We need to match react-router
naming conventions.
Right now, there is not way to trigger changes in history that will modify the client-side history as well. This is not presently feasible without changes to ReactPy core since there is no way for server-side components to send messages to client-side components - only client-side components can send messages to server-side ones.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.