Use an IDE like VS Code or WebStorm that is able to index the symbols (functions, classes, variables, etc) between files and lets you navigate to the declaration of a symbol or quickly locate everything using it.
I also draw out my own understanding of components or starting writing pseudocode for a function on paper (maybe it's something about the slow process of writing it out that forces you to think through it more).
See if the library has Typescript or Flow annotations - these can help a bit too in understanding the interfaces
Start from an entry point and mentally trace through the execution. Running some example code with your own console.log statements in the library helps too.