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

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

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!

An introduction to dynamic list rendering in Vue.js List rendering is one of the most commonly used practices in front-end web development. Dynamic list rendering is often used to present a series of similarly grouped information in a concise and friendly format to the user. In almost every web application we use, we can see lists of content in numerous areas of the app. In this article we’ll gather an understanding of Vue’s v-for directive in generating dynamic lists. We’ll also go through some examples of why the key attribute should be used when doing so. Since we’ll be explaining things thoroughly as we start to write code, this article assumes you’ll have no or very little knowledge with Vue (and/or other JavaScript frameworks). Case Study: Twitter We’re going to use Twitter as the case study for this article. When logged in and in the main index route of Twitter, we’re presented with a view similar to this: On the homepage, we’ve become accustomed to seeing a list of trends, a list of tweets, a list of potential followers, and so on.

Curi | Curi Documentation reLift-HTML | reLift-HTML

Related: