Install:
npm i prettier --save-exact
npm i husky lint-staged eslint-config-prettier
On eslintrc.js:
| // storybook-title.js | |
| let titleCounter = 0; | |
| function getNextSequentialTitle() { | |
| titleCounter++; | |
| return String(titleCounter); | |
| } | |
| export default function transformer(fileInfo, api) { |
| # Extremely basic development setup to serve the current directory at http://localhost:9001 | |
| # Start nginx in this directory with `nginx -p . -c nginx.conf` | |
| # Stop nginx with `nginx -p . -s stop` | |
| events {} | |
| http { | |
| # Serve files with correct mimetypes on OSX | |
| # location may have to be adjusted depending on your OS and nginx install | |
| include /usr/local/etc/nginx/mime.types; |
| // Set a page title in app.module.ts | |
| @NgModule({ | |
| imports: [ | |
| BrowserModule, | |
| ReactiveFormsModule, | |
| RouterModule.forRoot([ | |
| // ProductListComponent does not have a title | |
| { path: '', component: ProductListComponent }, | |
| // This page has a title |
Install:
npm i prettier --save-exact
npm i husky lint-staged eslint-config-prettier
On eslintrc.js:
| import React from 'react'; | |
| import styled from 'styled-components'; | |
| const Button = styled.a` | |
| line-height: 2; | |
| height: 5rem; | |
| text-decoration: none; | |
| display:inline-flex; | |
| color: #FFFFFF; | |
| background-color: #FF813F; |
| const axios = require("axios"); | |
| async function getData() { | |
| const response = await axios.get("https://cat-fact.herokuapp.com/facts"); | |
| console.log(response.data); | |
| } | |
| getData(); |
| var observer = new IntersectionObserver(changes => { | |
| for (const change of changes) { | |
| console.log(change.time); // Timestamp when the change occurred | |
| console.log(change.rootBounds); // Unclipped area of root | |
| console.log(change.boundingClientRect); // target.boundingClientRect() | |
| console.log(change.intersectionRect); // boundingClientRect, clipped by its containing block ancestors, and intersected with rootBounds | |
| console.log(change.intersectionRatio); // Ratio of intersectionRect area to boundingClientRect area | |
| console.log(change.target); // the Element target | |
| } | |
| }, {}); |
| const observer = new IntersectionObserver(callback); | |
| const target = document.querySelector('#target'); | |
| observer.observe(target); | |
| function callback(entries) { | |
| // Do action here | |
| } |
| function handleChange(value) { | |
| this.setState({ | |
| value: newValue | |
| }, ()=>{ | |
| console.log(this.state.value); | |
| }); | |
| } |
| function handleChange(value) { | |
| this.setState({ | |
| value: newValue | |
| }); | |
| console.log(this.state.value); //Why is my state not updated? | |
| } |