Show Menu
Cheatography

React Hooks Simples React Hooks Simples

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('­Suc­ces­sfully 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('­Wai­tin­g...');
 
`
 

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: '#363636',       color: '#fff',     },     // Default options for specific types     success: {       duration: 3000,       theme: {         primary: 'green',         secondary: 'black',       },     },   }} />
   
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          React & Material UI Project startup Cheat Sheet