Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avocode/reactmemory
ReactMemory.render(<App />, ReactMemory.createRoot())
https://github.com/avocode/reactmemory
Last synced: about 2 months ago
JSON representation
ReactMemory.render(<App />, ReactMemory.createRoot())
- Host: GitHub
- URL: https://github.com/avocode/reactmemory
- Owner: avocode
- Created: 2020-06-29T13:27:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T10:16:06.000Z (about 2 years ago)
- Last Synced: 2024-04-09T22:07:45.420Z (9 months ago)
- Language: JavaScript
- Size: 256 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ReactMemory
React renderer which **works without DOM** and **does not render anything** anywhere
## Motivation
Since React components encapsulate logic nicely and compose seamlessly, it starts being a pain to write headless (DOM-less) runtimes without it. This renderer allows writing general application logic (Node.js apps, Electron main process) as React components with JSX used for composition.
## Example
```js
function App({ process }) {
useEffect(() => {
console.log('App started')
return () => {
console.log('App terminated')
}
}, [])return (
<>
>
)
}function Server({ port }) {
useEffect(() => {
const server = http.createServer()
server.listen(port)
console.log(`Server starting on port ${port}`)return () => {
server.close()
console.log('Server stopped')
}
}, [port])return null
}ReactMemory.render(
,
ReactMemory.createRoot()
)
```## What Is Supported
- class and functional components
- fragments
- hooks
- mounting (the full lifecycle)
- rerendering of the root
- multiple root nodes### What Is NOT Supported
Please report anything you encounter.
## License
MIT