Content deleted Content added
Tag: Reverted |
Your code provides no explanation to introduce the user to the different hooks you're using. You're also importing unnecessary NPM modules and hooks that you are not using which introduce even more confusion. Please revise your example to be more streamlined and not depend on other modules or unknown localhost APIs, also please use a linter and code formatter before you submit any code snippets. Undid revision 1019281974 by C7pmc (talk) |
||
Line 175:
React provides a few built-in hooks like <code>useState</code>,<ref>{{Cite web|url=https://reactjs.org/docs/hooks-state.html|title=Using the State Hook – React|website=reactjs.org|language=en|access-date=2020-01-24}}</ref> <code>useContext</code>, <code>useReducer</code> and <code>useEffect</code>.<ref>{{Cite web|url=https://reactjs.org/docs/hooks-effect.html|title=Using the Effect Hook – React|website=reactjs.org|language=en|access-date=2020-01-24}}</ref> Others are documented in the Hooks API Reference.<ref>{{Cite web|url=https://reactjs.org/docs/hooks-reference.html|title=Hooks API Reference – React|website=reactjs.org|language=en|access-date=2020-01-24}}</ref> <code>useState</code> , <code>useReducer</code> and <code>useEffect</code>, which are the most used, are for controlling state and side effects respectively.
==== Rules of hooks ====
There are rules of hooks<ref>{{Cite web|url=https://reactjs.org/docs/hooks-rules.html|title=Rules of Hooks – React|website=reactjs.org|language=en|access-date=2020-01-24}}</ref> which describe the characteristic code pattern that hooks rely on. It is the modern way to handle state with React.
|