1×
Become a member
to unlock all features

Create egghead account to access 5000+ tutorials and resources from expert developers.

Create account
Autoplay

    Share Complex Logic across React Components with Custom Hooks

    reactReact

    A lot of the time, when you define logic in a component, you will want to reuse it in a few different places within your application as separate instances.

    In this lesson, we will break out the logic of our StopWatch Component and use two instances within our stopwatch and compare the difference between the two lapse instances.

    You'll learn:

    • Create a function as a custom hook for your components
    • Create multiple instances of the logic within a component
    • Compare the values between the two instances.