background preloader

Share reusable code components as a team · Bit

Share reusable code components as a team · Bit
Related:  REACT.JSFRAMEWORKS & LIBRARIES JavaScriptWorkflow

9 CSS in JS Libraries you should Know in 2019 Let’s get started. You can read this recommended discussion to help you make a good decision, and here’s a very cool comparison of projects. Good luck! 1. An idea born in an Australian Whisky bar turned into an 18K stars project, widely adopted in the community. Styled-components are created by defining components using the ES6 template literal notation. Tip: Styled-components can also be combined with Bit, to share them between apps and develop in a visual playground. Also check out: Stylable by Wix-Eng which is still in development. 2. At 6.5K stars and created by FormidableLabs, Radium is defined as “A toolchain for React component styling”. Radium lets you bundle up styles with your React components, coupling javascript, html, and styling together. 3. Aphrodite is a framework-agnostic CSS-in-JS library with support for server-side rendering, browser prefixing, and minimum CSS generation. 4. 5. Note: the project is no longer actively maintained! 6. 7. 8.

slick - the last carousel you'll ever need Set up your HTML markup. <div class="your-class"><div>your content</div><div>your content</div><div>your content</div></div> Move the /slick folder into your project Add slick.css in your <head> <link rel="stylesheet" type="text/css" href="slick/slick.css"/> // Add the new slick-theme.css if you want the default styling <link rel="stylesheet" type="text/css" href="slick/slick-theme.css"/> Add slick.js before your closing <body> tag, after jQuery (requires jQuery 1.7 +) Initialize your slider in your script file or an inline script tag When complete, your HTML should look something like: NOTE: I highly recommend putting your initialization script in an external JS file.

How to integrate Prettier with ESLint and stylelint by Abhishek Jain or How to never worry about code styling again ESLint and stylelint are really amazing tools that allow you to enforce coding patterns among your teams. This has many benefits, like outputting better and more consistent code, getting rid of useless diffs in commits (newline, indentation, et al.) among many others. But over time, this can prove to be a bit of a hassle among the developers of a team, who find it an extra mental burden to manually add semicolons, newlines, indentations, etc just to conform to the lint rules. Prettier can be set up to automatically format your code according to some specified rules. However, you don’t want to create a new Prettier config file, since you already have all the formatting related rules specified in your ESLint and stylelint config files. Let’s now dive into a step by step of how to set this all this up, and also how to format all of your existing code according to the lint rules. PART 1: Formatting the existing codebase Step 1

Web Components with Stencil.js — is it the best way to create reusable UI elements in 2018? The ability to develop universal, framework and library agnostic UI elements that can be shared among different projects and teams seems to be the perfect medicine for at least part of what we call a framework churn in modern front end world. Ever since I’ve started working as a web developer I witnessed a number of elements and interactions that can be abstracted away to a reusable code, but differences between frameworks and their implementation details were making it cumbersome… Web components seem to be an answer. But wait, what are the web components? Web Components is a suite of different technologies allowing you to create reusable custom user interface components — with their functionality encapsulated away from the rest of your code — and utilize them in your web apps. Millions of people around the world already use this technology every day. A few words about technologies involved Shadow DOM Styling Custom Elements Polymer

Props This page assumes you’ve already read the Components Basics. Read that first if you are new to components. Prop Casing (camelCase vs kebab-case) HTML attribute names are case-insensitive, so browsers will interpret any uppercase characters as lowercase. That means when you’re using in-DOM templates, camelCased prop names need to use their kebab-cased (hyphen-delimited) equivalents: Again, if you’re using string templates, this limitation does not apply. Prop Types So far, we’ve only seen props listed as an array of strings: Usually though, you’ll want every prop to be a specific type of value. This not only documents your component, but will also warn users in the browser’s JavaScript console if they pass the wrong type. Passing Static or Dynamic Props So far, you’ve seen props passed a static value, like in: You’ve also seen props assigned dynamically with v-bind, such as in: In the two examples above, we happen to pass string values, but any type of value can actually be passed to a prop.

React Redux Tutorial for Beginners [2019] December 13, 2018 - Edit this Post on GitHub Even though I have written a book about Redux in React, it may be too heavy on the subject for someone who wants only to try out a React Redux tutorial. That’s why I extracted this chapter from my book to be read as a tutorial for beginners on my website for free to learn the basics about Redux and Redux in React. And who knows, if you want to dig deeper into the topic, you can still try out my book about Redux in React called Taming the State in React to learn more advanced techniques, best practices and enhancing libraries for Redux. If you are a React beginner, I highly recommend you to get yourself comfortable with React in the first place. How to learn X with React Redux? Before we get started, one thing should be clear: This React Redux tutorial for beginners only involves React, Redux and a bit of Redux’s ecosystem. My recommendations on how to learn these other solutions on top of React Redux: The data flow goes in one direction. ...

iamkun/dayjs: ⏰ Day.js 2KB immutable date library alternative to Moment.js with the same modern API EditorConfig, Prettier et ESLint sur VS Code Lors du développement d’un projet, il arrive souvent de partir sur de mauvaises bases en termes d’indentation et de normes de code. Pour y remédier, il existe des outils qui permettent de palier à ce genre de désagrément. Avant de commencer, vérifiez que vous avez Node et NPM installés sur votre machine à l’aide de la commande node –v && npm –v ainsi que VS Code code –version. Puis instanciez un nouveau projet avec la commande npm init –y. EditorConfig EditorConfig permet d’avoir des styles de codes uniformes dans des projets où plusieurs développeurs interviennent sur les mêmes fichiers. VS Code Pour prendre en compte ce fichier dans VS Code, il faut installer le plugin officiel “EditorConfig for VS Code” (CTRL + SHIFT + X). Configuration A la racine de votre projet, modifiez le fichier “.editorconfig” avec le contenu ci-dessous. root = true [*] indent_style = tab indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true Prettier Installation

reLift-HTML | reLift-HTML Vue.js Components Communication Components in Vue can communicate in various ways. Props The first way is using props. Parents “pass down” data by adding arguments to the component declaration: Props are one-way: from parent to child. Any time the parent changes the prop, the new value is sent to the child and rerendered. The reverse is not true, and you should never mutate a prop inside the child component. Using Events to communicate from children to parent Events allow you to communicate from the children up to the parent: The parent can intercept this using the v-on directive when including the component in its template: You can pass parameters of course: and retrieve them from the parent: Using an Event Bus to communicate between any component Using events you’re not limited to child-parent relationships. You can use the so-called Event Bus. Above we used this. What we can do instead is to emit the event on a more generally accessible component. this. Any other component can listen for this event. Alternatives

How Redux Works: A Counter-Example After learning a bit about React and getting into Redux, it’s really confusing how it all works. Actions, reducers, action creators, middleware, pure functions, immutability… Most of these terms seem totally foreign. So in this post we’re going to demystify how Redux works with a backwards approach and a very simple React + Redux example that I think will help your understanding. As in the what does Redux do post, I’ll try to explain Redux in simple terms before tackling the terminology. If you’re not yet sure what Redux is for or why you should use it, read this explanation of Redux and then come back here. First: Plain React State We’ll start with an example of plain old React state, and then add Redux piece-by-piece. Here is a counter: And here’s the code (I left out the CSS to keep this simple, so it won’t be as pretty as the image): As a quick review, here’s how this works: Quick Setup If you’d like to follow along with the code, create a project now: On to the React Redux Example Hey! Action

RE:DOM – Tiny turboboosted JavaScript library for creating user interfaces How to properly set up Nuxt with ESLint and Prettier in VSCode With JavaScript being a dynamic and loosely-typed programming language problems and errors can potentially stay undetected for a very long time. To analyze code and to find errors, JavaScript applications are typically executed. This however, is a complete waste of processing power and hinders a fast development process. As an alternative, static analysis tools can be used. Setting up linting and formatting requires 3 steps: Installing the needed development dependenciesInstalling VSCode extensions (needed for error highlighting etc.)Actually configuring ESLint to make it support .vue files and to integrate code formatting To install the development dependencies we issue the following command inside the root directory of our project: npm install eslint babel-eslint eslint-config-prettier eslint-plugin-prettier eslint-plugin-vue eslint-loader prettier -D The next step is to install some extensions, to enable error highlighting and automatic fixes. That’s it! Happy Coding!

Introduction to Web Components W3C Working Group Note 24 July 2014 This version Latest version Latest editor's draft Previous version Revision history Participate Discuss on public-webapps@w3.org (Web Applications Working Group) File bugs (w3.org's Bugzilla) Editors Dimitri Glazkov, Google, <dglazkov@chromium.org> Hayato Ito, Google, <hayato@google.com> Authors Dominic Cooney, Google, <dominicc@google.com> Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. Abstract This document is a non-normative reference, which provides an overview of Web Components. Status of This Document This section describes the status of this document at the time of its publication. Work on this document has been discontinued and it should not be referenced.

Related: