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 - webcomp/webcomp: Smart "batteries included" Web Components in a modern way

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
packages
packages
 
 
utils
utils
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
lerna.json
lerna.json
 
 
package.json
package.json
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

WebComp

WebComp.js is a "batteries included" JavaScript library for writing smart reusable Web Components in a modern way.

Inspired by React components, WebComp provides familiar state management mechanisms and Virtual DOM, while also providing all of the sweetness of Web Components like Shadow DOM, server side rendering placeholders and ability to render from a string.

Features

  • JSX
  • React-like syntax
  • Virtual DOM
  • Shadow DOM
  • Component and element lifecycle hooks
  • Attribute to props mapping
  • Event based communication
  • State sharing (context)
  • Routing
  • Tiny bundle size

Getting Started

1. Install WebComp

npm install @webcomp/core

2. Import WebComp

import { WebComponent, register } from '@webcomp/core';

3. Create your component

class SuperHeader extends WebComponent {
  render(props) {
    return (
      <div>
        <h1>{props.text}</h1>
        <h3>It's Superpowered!</h3>
      </div>
   );
  }
}

Looks familiar? WebComp components are written in the exact same way as React components.

Note: Because WebComp uses Preact for rendering JSX, props and state are passed as arguments to the render() method for convenient destructuring. You can still use this.props and this.state if you want to, but it's not required.

4. Register your custom tag

register(SuperHeader, 'super-header');

Second argument is an optional tag name. If not set, component name converted to dash-case will be used.

5. Use it!

<div id="main">
  <super-header text="This is not a simple header!"></super-header>
</div>

Documentation

You can read the full documentation here →

About

Smart "batteries included" Web Components in a modern way

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

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.