import { useState, useEffect, useCallback } from 'react' | |
function usePromise(createPromise) { | |
const [error, setError] = useState() | |
const [value, setValue] = useState() | |
useEffect(() => { | |
let current = true | |
createPromise().then( |
{ | |
"workbench.sideBar.location": "left", | |
"editor.minimap.enabled": false, | |
// "editor.detectIndentation": true, | |
"editor.tabSize": 2, | |
"todohighlight.isEnable": true, | |
"workbench.startupEditor": "newUntitledFile", | |
"workbench.colorTheme": "Framer Syntax", | |
"window.zoomLevel": 0, | |
"editor.renderControlCharacters": false, |
Div with a attribute
const Loader = styled.div<{ width: string }>`
`;
Sets
Jez Williams
Since graduating in computer science six years ago, I’ve found love in the creative side of the web. I’ve been freelancing for three years and enjoy being in new environments and learning new skills. Most recently, I’ve been building with React and progressing deeper into backend development to compliment my frontend skills.
💻 jezfx.com ✉️ [email protected]
Front end, React, Gatsby, GraphQL / Aug 2018 - present
Make everything opt-in
Start with a plain base and make any styling changes optional extras that can be added.
- Ensure people can choose what they want.
- Never force changes unless you really mean to. Provide additional functionality via options.
- Expose API-like CSS.
- It’s easier to opt into something than it is to undo it.
Single Responsibility Principle
Things I've learnt from Wesbos.com course
var
variables can be updated or mutated, which means you can re-delare a var
again.
var
variables are function scope. Which means their only available inside the function that they were created. Or, global scope if they've been created outside a function.
const
and let
are block scope which means they are confined inside any block, even if
statements.
DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo: https://cure53.de/purify
Transform SVG into React components 🦁
Short id generator. Url-friendly. Non-predictable. Cluster-compatible. https://www.npmjs.org/package/shortid