This project was started by dewball345.
Breact is similar to react, with components and state. The main difference, however, is that Breact doesn't have a virtual dom; instead, each stateful element (element that uses setState) is assigned a unique id and is retrieved and changed when necessary. There isn't much that I have added - just the bare minimum, for now. The source code is around 100 lines of code and the simple hash router, which is a python implementation of the simple router in Dev.to's tutorial, caps at around 50. You can find the tutorial at: https://dev.to/pixari/build-a-very-basic-spa-javascript-router-2k4p
Breact is powered by Brython.
Contributions are welcome as the project is largely unfinished; for example, sanitizing data to prevent XSS attacts, lifecycle methods, and many more need to be implemented.
Breact has a sister framework, Ryact. They are both similar in different. Here is a table to help you choose that framework that you may need.
Breact | Ryact |
---|---|
Designed for easy development | Designed for speed; development may be harder |
Full python syntax | Mostly python syntax, but some things, like: casting, lambdas, etc. may not work. Check the rapydscript documentation for more info |
Super slow speed | Blazing fast code |
Code is not precompiled in advance, and supports live reload | Code is precompiled in advance, which makes things faster; you have to run the compile function before seeing changes |
You can use custom python modules | you cannot use many custom python modules |
choose wisely
- Option 1: with
git-svn
If you have git-svn installed, you can clone the breact
folder in this repository, as that contains the main source code.
git svn clone https://github.com/dewball345/Breact/trunk/breact
Unfortunately, you cannot do pip install breact
at the moment because of some issues with importing with brython.
- The most obvious: Use python instead of javascript to create complex web apps
- Work with a component-based system with state-management when developing SPA's
- Use preexisting libraries like bootstrap, tailwind, and more!
You can find a tutorial at this link
Breact can work with github hosting, but the process is kind of finicky and tedious.
For one, you will have to change your script tags to the raw github link, or it will not work.
In addition, you will have to create your own event handlers for client-side routing.
An alternative to this is to use another hosting platform. A great free option is firebase hosting
Solution
Put your main code in a directory. You can name it anything.
.
└── fbhosting/
└── your main code
Then, follow the normal directions for firebase hosting. Select the directory that you put your main code in when it asks for a /public
folder.
It has been brought to my attention that brython supports giving a list of children, so this function is unnecessary. I will not delete it as it is used quite a lot in this file.
If you would like to see what to use instead of group()
, view this issue
An example breact project can be found at: https://github.com/dewball345/breact-example
Want to see a Live Demo?
- Issue Tracker: github.com/dewball345/Breact/issues
- Source Code: github.com/dewball345/Breact
Make sure that you follow the Code of Conduct
Please write issues in the issue tracker
dewball345/Breact is licensed under the BSD 3-Clause "New" or "Revised" License