GithubHelp home page GithubHelp logo

maidang1 / react-unforget Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mohebifar/react-unforget

0.0 0.0 0.0 1.61 MB

A compiler for automatic optimization of React apps

Home Page: https://react-unforget.vercel.app/

License: MIT License

JavaScript 3.73% TypeScript 83.37% CSS 0.38% MDX 12.52%

react-unforget's Introduction

React Unforget

React Unforget is a compiler designed to enhance the performance of React applications through intelligent memoization and optimization. By analyzing and transforming React components and hooks, React Unforget aims to reduce unnecessary re-renders and optimize the execution flow, thus bridging the performance gap with more efficient frameworks like Svelte.

For demos and more information, visit the official website.

How It Works

The transformation process involves two main steps:

  1. Computing Dependency Graph: The initial step involves creating a segment from the root block statement and performing a dependency graph traversal to understand the interdependencies between various code segments.

  2. Transforming Segments: Based on the dependency graph, code segments are transformed to optimize their execution and reduce unnecessary computations.

Features

  • Intelligent component and hook memoization: Automatically identifies and memoizes React components and hooks, ensuring that only necessary re-renders occur. This leads to a more performant yet with more readable code.
  • Granular JSX element unwrapping: Unwraps JSX elements and memoizes each element and expression separately for more effective optimization. Eliminiating the need to use React.memo.
  • Memoization beyond early returns: React Unforget uniquely enables the memoization of values even after early returns in component functions, eliminating the need to restructure your code to comply with the Rules of Hooks. This ensures optimization without altering the logical flow of your components.

Comparison with React Compiler

React Compiler (Forget) is still under development and its release date remains uncertain. React Unforget offers an alternative approach to optimizing React applications, similar to how Preact serves as an alternative to React. It not only provides a fallback option but also pushes the boundaries of what's possible within the React ecosystem, encouraging innovation and diversity in optimization techniques.

License

React Unforget is open-source software licensed under the MIT license. Feel free to use, modify, and distribute it as per the license terms.

react-unforget's People

Contributors

mohebifar avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.