useResize custom hook.
Custom hook as per Sophie Alpert on StackOverflow function that returns the height and width on each update of the window
import React from 'react'; | |
import { renderHook } from '@testing-library/react-hooks'; | |
import stateFactory from 'jest/stateFactory'; | |
import configureMockStore from 'redux-mock-store'; | |
import { Provider } from 'react-redux'; | |
import { Store, AnyAction } from 'redux'; | |
import { initialState as initialPaginationState } from '../../store/pagination/reducer'; | |
import { useMyAwesomeHook } from '../useMyAwesomeHook'; |
:root { | |
--violation-color: red; /* used for clear issues */ | |
--warning-color: orange; /* used for potential issues we should look into */ | |
} | |
/* IMAGES */ | |
/* | |
* Lazy-Loaded Images Check | |
* ==== |
useResize custom hook.
Custom hook as per Sophie Alpert on StackOverflow function that returns the height and width on each update of the window
In this article I compare the performance of the spread operator ...
and the performance of the assignement operator =
in the context of data transformation.
I show that using the spread operator isn't a trivial choice to make and I suggest that immutability and mutation don't have to be mutually exclusive. I also show how one-liner functions can be enriched with the comma operator ,
.
In addition to the Storybook for React setup, you'll also need to install these packages:
npm i -D @babel/core babel-loader css-loader style-loader
import React from "react"; | |
export const Recipeitem = (props) => { | |
return (<div> | |
{props.title} | |
</div>) | |
} |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
"use strict"; | |
// Load plugins | |
const autoprefixer = require("autoprefixer"); | |
const browsersync = require("browser-sync").create(); | |
const cp = require("child_process"); | |
const cssnano = require("cssnano"); | |
const del = require("del"); | |
const eslint = require("gulp-eslint"); | |
const gulp = require("gulp"); |
// POLYFILLS | |
// Event.composedPath | |
// Possibly normalize to add window to Safari's chain, as it does not? | |
(function(E, d, w) { | |
if(!E.composedPath) { | |
E.composedPath = function() { | |
if (this.path) { | |
return this.path; | |
} | |
var target = this.target; |