Open JoeDuncko opened 3 years ago
@JoeDuncko dang it! we already have a queue hook, but it is missing from hooks listing🤦♂️
@JoeDuncko dang it! we already have a queue hook, but it is missing from hooks listing🤦♂️
@xobotyi Ah crap, I can knock that out if no one else does tomorrow.
@JoeDuncko @xobotyi
I was just looking to work on useCopyToClipboard
, but then found this discussion where we have concluded that it is not needed at the moment. Can we remove this from this list also, if we don't want to build it.
@JoeDuncko @xobotyi
Moreover, I am looking to work on useSpeech
with the following definition, is this fine or do we want to improve here?
type SpeechOptions = {
lang: string;
voice?: SpeechSynthesisVoice;
rate: number;
pitch: number;
volume: number;
};
export type VoiceInfo = Pick<SpeechSynthesisVoice, 'lang' | 'name'>;
export type ISpeechState = SpeechOptions & {
isPlaying: boolean;
status: string;
voiceInfo: VoiceInfo;
};
enum Status {
init,
play,
pause,
end,
}
const useSpeech = (text: string, options: ISpeechOptions): ISpeechState
Same as we have in react-use
@malavshah9 sold!
@xobotyi I wanted to work and port below mentioned hooks:
useIdle
useRaf
useGeolocation
useStateList
@malavshah9 it would be way better if youll help with tests migration so we can switch towards react 18
https://github.com/react-hookz/web/pull/1377
I will update that PR so it is containing only tests changes without, and after that youll be able to migrate tests
@xobotyi I would love to do that. Should I start migrating that for each hooks and giving you separate PR?
Our goal with
@react-hookz/web
is to give the react community a general-purpose React hooks library built with care.We'd like to port the remaining hooks from react-use (the project
@react-hookz/web
grew out of) while keeping in mind our tenants:Hooks to port
Sensors
useHash — tracks location hash value.(No plans to implement. Instead, use one the various routing libraries available.)useKey — track keys.(Implemented as useKeyboardEvent)useKeyPress — track keys.(Implemented as useKeyboardEvent)useKeyboardJs — track keys.(Implemented as useKeyboardEvent)useKeyPressEvent — track keys.(Implemented as useKeyboardEvent)useLocation — tracks page navigation bar location state.(No plans to implement. Instead, use one the various routing libraries available.)useSearchParam — tracks page navigation bar location state.(No plans to implement. Instead, use one the various routing libraries available.)useSize — tracks an HTML element's dimensions.(UseuseWindowSize
instead)createBreakpoint — tracks innerWidth(Not planning to implement)UI
Animations
useInterval and useHarmonicIntervalFn — re-renders component on a set interval using setInterval.(Implemented asuseIntervalEffect
).useTimeout — re-renders component after a timeout.(Can be composed from other hooks, see migration guide).useTimeoutFn — calls given function after a timeout.(Implemented asuseTimeoutEffect
).Side-effects
useBeforeUnload — shows browser alert when user try to reload or close the page.(No plans to implement, address migration guide for workaround)useCopyToClipboard — copies text to clipboard.(no plans to implement - use browser's API instead)useFavicon — sets favicon of the page.(Hooks that modify theuseThrottleFn — throttles a function.useTitle — sets title of the page.(Hooks that modify theLifecycles
useEffectOnce — a modified useEffect hook that only runs once.(it's just an alias foruseMountEffect
)useLifecycles — calls mount and unmount callbacks.(no sense to port, has almost no benefit comparing touseEffect
)useUnmountPromise — track if component is mounted.(No plans to implement).usePromise — resolves promise only while component is mounted.(No plans to implement)useLogger — logs in console as component goes through life-cycles.(Implemented as useLifecycleLoggerState
createMemo — factory of memoized hooks.(Not planning to implement)createReducer — factory of reducer hooks with custom middleware.(Not planning to implement)createReducerContext — factory of hooks for a sharing state between components.(Not planning to implement)createStateContext — factory of hooks for a sharing state between components.(Not planning to implement)useDefault — returns the default value when state is null or undefined.(No plans to implement. Use useMediatedState instead).useGetSet — returns state getter get() instead of raw state.(No plans to implement)useGetSetState — as if useGetSet and useSetState had a baby.(No plans to implement)useSetState — creates setState method which works like this.setState.(No plans to implement)useNumber — tracks state of a number.(Implemented as useCounter)useUpsert — tracks state of an array.(UseuseList
instead.)useRendersCount — count component renders.(Implemented asuseRenderCount
).createGlobalState — cross component shared state.(Not planning to implement)useMethods — neat alternative to useReducer.(No plans to implement)Miscellaneous
Join our community!
Have a question? Create a discussion on GitHub or join our Discord community.
Interested in contributing code? Check out our contribution guide. We are excited to see your pull request!