Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mohebifar/vidact
A compiler that converts React-compatible codes to VanillaJS with no Virtual DOM
https://github.com/mohebifar/vidact
Last synced: 20 days ago
JSON representation
A compiler that converts React-compatible codes to VanillaJS with no Virtual DOM
- Host: GitHub
- URL: https://github.com/mohebifar/vidact
- Owner: mohebifar
- License: mit
- Created: 2020-03-07T06:19:40.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-08T05:51:47.000Z (over 1 year ago)
- Last Synced: 2024-10-10T22:15:21.892Z (2 months ago)
- Language: TypeScript
- Homepage: https://mohebifar.github.io/vidact/
- Size: 3.65 MB
- Stars: 788
- Watchers: 13
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - vidact - compatible codes to VanillaJS with no Virtual DOM | mohebifar | 769 | (TypeScript)
- awesome-list - vidact - compatible codes to VanillaJS with no Virtual DOM | mohebifar | 716 | (TypeScript)
README
![Travis (.org)](https://img.shields.io/travis/mohebifar/vidact)
![npm](https://img.shields.io/npm/v/vidact)# Vidact
Vidact compiles your React source codes to VanillaJS code with **No Virtual DOM** ™️. It is similar to Svelte, but unlike [Svelte](https://svelte.dev/), Vidact does not introduce a new syntax. It takes in pure React-compatible JavaScript (JSX) and outputs plain JavaScript.
Vidact currently is in alpha phase and has known limitations. It does not fully comply with React's behaviour in some edge cases, and probably never will, but the goal is to get as close behaviour to React as possible. Also, it currently only supports functional components and does not support class components.
## How does it work and how is it different from React?
Vidact is a babel-plugin that scans your source code to find what parts of the UI need to be updated in response to a prop or state change and generates a plain JavaScript code that should have the same DOM result as the equivalent React code. Note that all of this is done in build time! Whereas React does the bulk of its work in runtime in the browser by leveraging Virtual DOMs to determine what needs to be updated in the actual DOM.
## When should I use it instead of React?
_Vidact is not currently ready to be used in production._
The goal is to have an alternative library for those who love React, but are looking for a more lightweight and high-performance implementation for smaller projects.
# Roadmap
- [x] JSX conversion for native HTML elements
- [x] JSX conversion for component elements
- [x] Support event listeners for native HTML elements
- Proxy onChange for text inputs and textarea
- [x] Support inline styles
- [x] Reactive props
- [x] Basic array child nodes support
- [x] useState: Stateful components
- [ ] Dangerously set innerHTML
- [x] useRef
- [x] useEffect
- [ ] useEffect with cleanup (detect component unmount)
- [x] useCallback
- [x] useMemo
- [ ] Conditional expression performance
- [ ] Support custom hook functions built upon native hooks
- [ ] Improve array child support
- Avoid refreshing elements with the same key and only do prop updates instead
- Avoid refreshing rearranged elements with the same key
- [ ] SVG support
- [ ] Support components with multiple conditional return statements
- [ ] Support context
- [ ] SSR support
- [ ] Props spread