Skip to content

Instantly share code, notes, and snippets.

Avatar
♨️
Missing Zsófia 👧🏼🇭🇺

Glenn Dwiyatcita dwiyatci

♨️
Missing Zsófia 👧🏼🇭🇺
View GitHub Profile
@markerikson
markerikson / render-logic.js
Last active Oct 27, 2020
React render function organization
View render-logic.js
class ParentComponent extends Component {
render() {
// My basic render function structure:
// 1) Extract values from props and state
const {a, b, someBoolean, someList} = this.props;
// 2) Render any dependent items into temporary variables, such as conditional components or lists
const conditionalComponent = someBoolean ? <SomeComponent /> : null;
const listItems = someList.map(item => <ListItem item={item} />);
@mathiasbynens
mathiasbynens / change-favicon.js
Created Jun 7, 2010
Dynamically changing favicons with JavaScript
View change-favicon.js
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {
You can’t perform that action at this time.