Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
// Usage - | |
//import {useFetch} from "./useFetch.js"; | |
//const url = "https://raw.githubusercontent.com/ajzbc/kanye.rest/quotes/quotes.json"; | |
//const {data, loading} = useFetch(url); | |
// -- | |
//Defining hook inside useFetch.js file. | |
import { useEffect, useState, useRef } from "react"; | |
export const useFetch = (url) => { | |
const isMounted = useRef(true); |
const getMutable = (state) => JSON.parse(JSON.stringify(state)); // This is doer. | |
const mutableState = getMutable(state); | |
mutableState.books[0].section[2] = 'Things to be learned in august.'; | |
mutableState.books[1].section[4] = 'Things to be learned in november.'; | |
dispatch(mutableState); | |
// ---------------------------------------------------------------------------------------------------------- | |
// Antoher simple approach is using closures like immer.js does(but it does some depth comparisons too), for e.g. below is my |
const useCancellable = fn => { | |
const requestRef = useRef(0) | |
return async (...args) => { | |
// Keep track of latest promise ID | |
const id = Date.now() | |
requestRef.current = id | |
// Wait for resolution | |
const res = await fn(...args) |
// Source | |
const MyCompSource = '' | |
// @source MyCompSource | |
const MyComp = ( | |
<div> | |
Hello there! | |
</div> | |
) |
license: gpl-3.0 |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> /* set the CSS */ | |
.bar { fill: steelblue; } | |
</style> | |
<body> | |
<!-- load the d3.js library --> |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
// Javascript | |
import { Render, Router, Route, Redirect, IndexRoute, IndexRedirect } from 'jumpsuit' | |
Render(state, ( | |
<Router> | |
<Route path='/' component={Layout}> | |
<IndexRoute component={Teams} /> | |
<Route path='me' component={Me} /> | |
<Route path='workspaces' component={Workspaces} /> | |
<Route path='invite' component={WorkspaceInvite} /> |