Hooks React Cheat Sheet

A Programming › JavaScript cheat sheet in English by irvincnt93

React Hooks Simples React Hooks Simples

6,046 views 822 downloads 23 Nov 2021 History

Hooks

useState
const [count, setCount] = useSta­te(0);
useReducer
const [todos, dispatch] = useRed­uce­r(t­odo­sRe­ducer);
useFri­end­Status
const isOnline = useFri­end­Sta­tus­(pr­ops.fr­ien­d.id);
Hooks basic

react-­hot­-toast

 
toast(­'­Hello World');
 
toast.s­uc­ces­s('S­ucc­ess­fully create­d!');
 
toast.e­rr­or(­'This is an error!­');
 
toast.c­us­tom­(<d­iv>­Hello World<­/di­v>);
 
toast.l­oa­din­g('W­ait­ing...'­);
 
`

toast

<To­aster positi­on=­"­top­-ce­nte­r" revers­eOr­der­={f­alse} gutter={8} contai­ner­Cla­ssN­ame­="" containerStyle={{}} toastOptions={{ // Define default options className: '­', duration: 5000, style: { backgr­ound: '­#36­363­6', color: '­#ff­f', }, // Default options for specific types success: { duration: 3000, theme: { primary: '­gre­en', secondary: '­bla­ck', }, }, }} />

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.