Certain functionalities are universally required in apps. No matter what kind of app you're building there is a good chance it will need a way to handle user logins with permissions, logging, and error handling. These are known as cross cutting concerns. You may also find that two different components share a majority of their underlying logic. For example, a component that displays the number of people in a mailing list and a component that displays all the active orders for a business could be 80% the same under the hood. As we know, well designed programs do not repeat themselves. One way to extract this functionality is with a custom hook. The issue with the custom hook is that any component they are used in becomes stateful. This violates another principle of app design, that we want to keep our state as lean as possible with the minimum number of stateful component. The solution here is to use an advanced tool in React called a higher order component. The higher order component is a function that takes another component as its argument and returns another component with enhanced functionality.
Subscribe to:
Post Comments (Atom)
190: Sablier
The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...
-
The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...
-
The ZKasino project recently exit scammed over 33 million dollars worth of Ethereum. he recent debacle surrounding ZKasino offers valuable...
-
In addition to its native SDK, Hedera also supports smart contracts in a platform compatible with the Ethereum Virtual Machine. This allows ...
No comments:
Post a Comment