GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - AimWhy/simple-react: Fast 3kb React alternative. Components & Virtual DOM

BranchesTags
Open more actions menu

Latest commit

 

History

33 Commits
33 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 
demo.html
demo.html
 
 
demo.js
demo.js
 
 
simple-react.js
simple-react.js
 
 
simple-react.min.js
simple-react.min.js
 
 

Repository files navigation

fast, 3kb alternative to React, with the same ES2015 API.

Lifecycle method When it gets called
componentWillMount before the component gets mounted to the DOM
componentDidMount after the component gets mounted to the DOM
componentWillUnmount prior to removal from the DOM
componentDidUnmount after removal from the DOM
componentWillReceiveProps before new props get accepted
shouldComponentUpdate before render(). Return false to skip render
componentWillUpdate before render()
componentDidUpdate after render()
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>

<body>
    <div id="why"></div>
    <script src="../preact.js"></script>
    <script>
        var h = preact.h;
        var createClass = preact.createClass;
        var render = preact.render;

        var Clock = createClass({
            getInitialState: function () {
                return { time: Date.now() }
            },

            componentDidMount: function () {
                var that=this;
                this.timer = setInterval(function () {
                    that.setState({ time: Date.now() });
                }, 1000);
            },

            componentWillUnmount: function () {
                clearInterval(this.timer);
            },

            render: function (props, state) {
                var time = new Date(state.time).toLocaleTimeString();
                return h('span', null, time);
            }
        });

        render(document.getElementById('why'), h(Clock));
    </script>
</body>

</html>

modify from (preact)[https://github.com/developit/preact]

About

Fast 3kb React alternative. Components & Virtual DOM

Resources

Readme
Activity

Stars

9 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.