11/08
you can tell React to only execute the side effect once (at mount time), by passing an empty array: - react
useEffect(() => {
console.log(`Component mounted`)
}, [])
const debounce = (callback, wait) => { | |
let timeoutId = null; | |
return (...args) => { | |
window.clearTimeout(timeoutId); | |
timeoutId = window.setTimeout(() => { | |
callback.apply(null, args); | |
}, wait); | |
}; | |
} |
11/08
you can tell React to only execute the side effect once (at mount time), by passing an empty array: - react
useEffect(() => {
console.log(`Component mounted`)
}, [])
import * as say from './say.js';
say.sayHi('John');
say.sayBye('John');
Let’s say, we added a 3rd-party library say.js
to our project with many functions:
HTTP is stateless
What is HTTPS?
//The following helper function insertAfter() lets you insert a new element after an existing one in the DOM tree: | |
function insertAfter(newNode, referenceNode) { | |
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); | |
} | |
// example | |
var newEl = document.createElement('div'); | |
newEl.innerHTML = '<p>Hello World!</p>'; |
<?php | |
/** | |
* Plugin Name: WP Blocks | |
* Version: 1.0.0 | |
*/ | |
function loadMyBlockFiles() { | |
wp_enqueue_script( |
//init modules | |
const gulp = require('gulp'); | |
const browserSync = require('browser-sync').create(); | |
//settings (where paths are defined) | |
const settings = require('./settings'); | |
//TASKS | |
//puyih: put on hold SASS, minifiers, etc. features in wpbeter, if you need it later on check your gist |