This video is available to students only

Implementing Scroller

Writing code for the Scroller library and exporting it for users.

Clap
0|0|

Writing a hook#

Open up the Scroller directory and navigate to the src directory. Create a new file called useScroller.js. Enter the following code:

Let's break down what each line of the code above is doing. We'll start by exporting a function called useScroller which takes an options object which will tell us where to scroll to in the x/y coordinates, and if we should scroll smoothly.

Clap
0|0
 

This page is a preview of Creating React Libraries from Scratch

No discussions yet. Be the first. All notification go to the author.