This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { ReactNode } from 'react' | |
export interface TabProps { | |
name: string | |
isActive?: boolean | |
children: ReactNode | |
} | |
export const Tab = ({ children }: TabProps) => <>{children}</> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useReducer } from 'react'; | |
type Reducer<T> = (state: T, update: Partial<T>) => T; | |
export const useObject = <T>(initial: T) => { | |
return useReducer<Reducer<T>>((state, update) => ({ ...state, ...update }), initial); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// ludzie-iza.json | |
{ | |
"name": "Izabela", | |
"age": 25, | |
"city": "Warsaw", | |
"description": { | |
"pl": "Jestem programistką", | |
"en": "I'm a programmer", | |
"de": "Ich bin Programmiererin" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useMemo } from 'react'; | |
/** | |
* A hook that returns a memoized version of the given object or array. | |
* **Important!** Use only if the object structure or array length is not changing! | |
* | |
* @example | |
* ```ts | |
* const api = useStructMemo({ query, setQuery, count }); | |
* ``` |
OlderNewer