edit: nvm, it's listed in the readme as inspiration
Some differences compared to LiveView:
- Type-checking: there are extensive JSX typings (https://github.com/karthikv/purview/blob/master/src/types/js...) that ensure you're attaching event handlers with the correct signatures, specifying supported props, using valid HTML tags and attributes, etc. Static-typing guarantees are one of my big priorities.
- I'm not sure if LiveView intends to support nested components like React does. Having the ability to split up complex pages into components that you can nest and reuse (with mostly one-way data flow) is a key part of maintainability. I wanted to maintain a very familiar React interface, so you can pick up Purview quickly if you're comfortable with React.
https://github.com/share/sharedb
If you have a complex front-end and back-end with a REST API, each time you modify a server route, you need to find all instances in your client where you make an AJAX request to that route and change them appropriately. The potential for inconsistency can cause numerous bugs.
GraphQL solves this by having a very flexible and standardized server (albeit complex), giving your client access to arbitrary structured information using a query language.
Purview solves this by moving your logic to the server-side, where you can access your database directly. Because everything runs on the server, the client-server interface is abstracted away, and you don't need to worry about using GraphQL or REST. You can make database queries, contact external services, etc. directly within your components.
To keep this maintainable, you split up your page into logical, reusable components, just like you would with React, and each component now not only contains your view logic, but also the server-side logic. Given that you've decomposed your components well, this makes it easy to reason about the whole system when it comes to any part of your page.
Sorry, but any sane codebase usually abstracts away HTTP info like routes through services which means that your components only know about the dataService and don't care if the data is coming from a REST API or localStorage
The JS ecosystem is insane once you take a step back and look at it.
Huh? React components can run on the server side, that is one of the primary benefits of React compared to its predecessors.
On the update: This does seem kinda neat, and certainly useful in some situations.
Naturally, sending draw commands has a big downside in efficiency. Maybe we could later exchange X with something that only sends bitmaps?
Can we call the followup Wayland because that is the only way to go :)
There's a lot of criticism in this thread. I'm curious if you're using this in production. I love projects like this that really push the bounds of how these problems are typically solved.
* Type/change events fire on the field (e.g. username)
* Username updates the internal model (this.username = 'karthikksv')
* The submit button fires an event so the parent page can act on the entire data model ({ username: 'karthikksv', password: 'fluffykittens' })
I'm concerned that this model won't work well using server-side React components on a network with high latency – each type event would have to round-trip to the server to update in the DOM.
If you don't need to send each letter, it's recommended to not do so; the submit event object includes all form data, so you can do one final validation at the end, similar to what you'd do with a normal web server.
It's not actually React compatible.
Just why?
Existing components/libraries is the only reason I use react.
A good alternative that provides a nice setup for SSR on the initial page load as well as code splitting is nextjs https://github.com/zeit/next.js/
It does not help you with client side, so it is more like composable templates, but they are async, so you can query DB inside your components.
Full circle for sure!
One Lambda per component would be interesting tho, haha.