Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An implementation of React v15.x that optimizes for small script size

License

NotificationsYou must be signed in to change notification settings

Lucifier129/react-lite

Repository files navigation

TravisnpmJoin the chat at https://gitter.im/Lucifier129/react-lite

Introduction

react-lite is an implementation of React that optimizes for small script size.

Note: react-lite dose not support React v16.x now.

Size Comparison

FrameworkVersionMinified Size
Ember2.2.0446kb
Polymer1.0.6183kb
Angular1.4.8148kb
React0.14.3136kb
Web Components Polyfill0.7.19118kb
Riot2.3.1120kb
React-lite0.15.625kb
preact + preact-compat8.2.15kb

React-lite supports the core APIs of React, such as Virtual DOM, intended as a drop-inreplacement for React, when you don't need server-side rendering in browser(noReactDOM.renderToString &ReactDOM.renderToStaticMarkup).

Usage

If you are using webpack, it's so easy to use react-lite, justconfig alias in webpack.config.js:

// webpack.config.js{resolve:{alias:{'react':'react-lite','react-dom':'react-lite'}}}

Note: feel free to try react-lite, if something happen and we can't fix it in time, then useregular react instead.

Installation

You can install react-lite from npm:

npm install react-lite --save

Browser compatibility

supports IE9+ / ES5 enviroment

Documentation

learn react-lite fromReact official documentation

What can react-lite do?

just the same as what react does, see some demos below(I just add the alias to webpack.config.js, no need to do anything else):

React-lite vs React

via react-lite:

  • all of React.PropTypes method is no-op(empty function)
  • use React in server side rendering, and use React-lite in browser
    • react-lite will replace the dom tree with new dom tree
    • you had better avoidscript|head|link tag in client side
  • can not use react-dev-tool inspect react-lite, should switch to regular react for debugging
  • react-lite only works with a JSX toolchain(issue)
  • unlike react,event object in react-lite is always persistent, andevent.persist is set as no-op to avoid throwing error.
  • react-lite can't work withreact-tap-event-plugin, please usefastclick instead. or add alias'react-tap-event-plugin': 'react-lite/lib/react-tap-event-plugin', just likehere
  • can't work withtransform-react-inline-elements, you will get a bundle include bothreact andreact-lite.
  • react-lite just follow the best practice ofReact.

Test

react-lite reuses react's unitest(170), you can see them in__test__, and run the tests with:

npmtest

License: MIT (See LICENSE file for details)

About

An implementation of React v15.x that optimizes for small script size

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors19


[8]ページ先頭

©2009-2025 Movatter.jp