Current section
Files
Jump to
Current section
Files
live_react
README.md
README.md
[](https://github.com/mrdotb/live_react/actions)
[](https://hex.pm/packages/live_react)
[](https://hexdocs.pm/live_react)
[](https://github.com/mrdotb/live_react)
# LiveReact
React inside Phoenix LiveView.

## Features
- β‘ **End-To-End Reactivity** with LiveView
- πͺΆ **Incremental Prop Updates** β only what changed is sent over the wire
- π **Phoenix Streams** as props
- π **Form & Upload Encoding** β changeset errors and upload state, ready for React
- π **Server-Side Rendered** (SSR) React
- π¦ **Tailwind** Support
- π **Dead View** Support
- π **Lazy-loading** React Components
- π¦₯ **Slot** Interoperability
- π **Link Component** for LiveView Navigation
- π **Amazing DX** with Vite
## Resources
- [Demo](https://live-react-examples.fly.dev/simple) ([source](https://github.com/mrdotb/live_react_examples))
- [HexDocs](https://hexdocs.pm/live_react)
- [HexPackage](https://hex.pm/packages/live_react)
- [Phoenix LiveView](https://github.com/phoenixframework/phoenix_live_view)
- [Installation](/guides/installation.md)
- [Props Diffing and Streams](/guides/props-diffing.md)
- [Deployment](/guides/deployment.md)
- [Development](/guides/development.md)
- [SSR](/guides/ssr.md)
- [Upgrading to 2.0](/guides/upgrading-to-2.0.md)
## Example
Visit the [demo website](https://live-react-examples.fly.dev/simple) to see examples of what you can do with LiveReact.
Its source lives in [mrdotb/live_react_examples](https://github.com/mrdotb/live_react_examples).
You can also check out the [PhoenixAnalytics project](https://github.com/lalabuy948/PhoenixAnalytics) for a real-world example.
## Why LiveReact
Phoenix LiveView enables rich, real-time user experiences with server-rendered HTML.
It works by communicating any state changes through a websocket and updating the DOM in realtime.
You can get a really good user experience without ever needing to write any client side code.
LiveReact builds on top of Phoenix LiveView to allow for easy client side state management while still allowing for communication over the websocket.
## Installation
see [Installation](/guides/installation.md)
## Roadmap π―
- [ ] `useLiveForm` - a utility to effortlessly use Ecto changesets & server-side validation, similar to HEEx
The server side of this already exists: a `Phoenix.HTML.Form` passed as a prop
is encoded with its values, its changeset errors keyed by field, and its
validity β see [Props Diffing and Streams](/guides/props-diffing.md). What is
missing is the React-side hook that binds those to inputs.
## Credits
I was inspired by the following libraries:
- [LiveVue](https://github.com/Valian/live_vue)
- [LiveSvelte](https://github.com/woutdp/live_svelte)
I had a need for a similar library for React and so I created LiveReact π