Skip to content
/ ukejs Public

🎸Uke is a small experiment, writing a "React-like" framework without a single dependency.

Notifications You must be signed in to change notification settings

zwenza/ukejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UkeJS Logo

CircleCI

Uke is a small javascript library to write javascript application.

Purpose

I write this library to improve my vanilla javascript knowledge and to learn how modern javascript frameworks like React, Vue or Angular works.

This library has (and will never have) any dependencies on other libraries, because I want to build everything I need on my own.

‼ This library is not intended to use in real world applications! ‼

If you have questions, feel free to open issues and i will try to answer them 😊!

Features

  • components system
  • props
  • virtual dom
  • JSX support!
  • event handling
  • very (very!) basic routing
  • state handling

Upcoming:

  • partial node updates after state changes
  • redux reimplementation
  • better routing

Example

This maybe outdated because the API currently changes everyday basically 🤷

import { UkeCore, UkeRouter, Uke } from 'ukejs';

var app = UkeCore();
var router = UkeRouter();

const Concert = Uke.component({
  state: {
    playing: true
  },
  defaultProps: {
    song: 'Somewhere Over The Rainbow'
  },
  render: (props, state) => {
    return (
      <div>
        <h1>Welcome!</h1>
        <Ukulele type="supran" playing={state.playing} />
      </div>
    );
  }
});

const Ukulele = Uke.component({
  state: {
    volume: 'silent'
  },
  defaultProps: {
    name: 'David'
  },
  render: (props, state) => {
    return (
      <div>
        <p>
          My name is {props.name} and i {props.playing ? 'do' : "don't"} play{' '}
          {props.type} Ukulele! The ukulele is {state.volume}
        </p>
        <p />
        <button
          onClick={() => {
            Uke.setState(
              state => {
                state.volume = 'loud';
              },
              state,
              app
            );
          }}
        >
          louder!!!!
        </button>
      </div>
    );
  }
});

router.route('/', Concert);

app.router(router);
app.mount('app');

About

🎸Uke is a small experiment, writing a "React-like" framework without a single dependency.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published