I'm not sure a HoC for hooks is a good idea, but it seemed fun to build. Also, it may come in handy when adding new code to old components.
export default connectHooks([
{
hook: useFetch,
hookArgs: ["https://swapi.co/api/people/1"],
[ | |
{ | |
"id": "bierner.lit-html", | |
"name": "lit-html", | |
"publisher": "bierner", | |
"version": "1.11.1" | |
}, | |
{ | |
"id": "bradgashler.htmltagwrap", | |
"name": "htmltagwrap", |
[core] | |
excludesfile = /Users/juliettepretot/.gitignore_global | |
editor = code -n -w | |
ignorecase = false | |
[commit] | |
template = /Users/juliettepretot/.stCommitMsg | |
[push] | |
default = current | |
[diff] | |
tool = default-difftool |
import { useState, useEffect } from 'react' | |
// Use this hook to quickly read whether a component is being rendered server | |
// side or client-side. This can be helpful when building components that are | |
// intended to work without client-side JavaScript. | |
// Use like: | |
// const isMounted = useIsMounted() | |
const useIsMounted = () => { |
function fish_prompt | |
set -l last_status $status | |
set -l cyan (set_color -o cyan) | |
set -l yellow (set_color -o yellow) | |
set -l red (set_color -o AE111D) | |
set -l blue (set_color -o blue) | |
set -l green (set_color -o green) | |
if not set -q __fish_git_prompt_show_informative_status | |
set -g __fish_git_prompt_show_informative_status 1 |
import React from 'react' | |
import { render } from 'react-dom' | |
/* | |
The goal of this hook is to provide an alternative to using indexes as | |
keys in react. Instead, what if we could use the object references as keys. | |
Since React only accepts strings as keys, let's associate string keys to | |
object references. |
I hereby claim:
To claim this, I am signing this object:
describe('The `mergeTwoSortedArrays` function', () => { | |
it('merges two sorted arrays', async () => { | |
expect(mergeTwoSortedArrays([1, 3, 5, 7], [2, 4, 6, 8, 10])).toEqual([ | |
1, | |
2, | |
3, | |
4, | |
5, | |
6, | |
7, |