Git Product home page Git Product logo

vanilla-js-lithtml-components's Introduction

vanilla-js-lithtml-components

Table of contents

Overview

Screenshot

Links

Features

  • Reusable and customizable components
  • Lifecycle methods implemented with the MutationObserver API
  • Efficient rendering using lit-html
  • Mini-apps like a Tic-Tac-Toe game, a Notes app, a Filterable Table, a Clock, a Temperature Calculator, and a Counter
  • Display of active components on the page

My process

Built with

  • mobile-first workflow
  • semantic HTML5 markup
  • scss
  • javaScript
  • lit-html
  • webpack

What I learned

Through this project, I learned how to create reusable and customizable components in vanilla JavaScript. I also gained a deeper understanding of how the MutationObserver API works and how it can be used to implement lifecycle methods in components.

I also learned about lit-html and how it can be used to create efficient and dynamic templates that update only the parts that have changed. This can help improve the performance of the application and reduce the amount of unnecessary re-renderings.

I started this project by creating a basic Component class that all other components will inherit from. The Component class has lifecycle methods like "onConnected" and "onDisconnected" that are called when a component is added or removed from the DOM. I have also learned about the difference between debouncing and throttling function calls to control how many times we allow a function to be executed over time and based on the needs of the app I implemented the first one when calling the rerendering of the app.

As I wanted to test some real-life use cases I created several mini-apps like Tic-Tac-Toe, Notes app, etc. through the use of reusable components. These components use lit-html templates to render their UI and are easily customizable with props.

I also created another Counter component that keeps track of the number of active components on the page updating itself as we add or remove components from the page.

Continued development

In the future, I would like to add more mini-apps to this project and further refine the existing components. I would also like to explore other libraries and frameworks for creating reusable components and see how they compare to this approach.

Useful resources

Author

vanilla-js-lithtml-components's People

Contributors

mariushor avatar

Watchers

 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.