Organizing Imports in Large Files
In this example, we are importing several different variables from a separate file, but only one of them is used:
import { MAX_PAGE, DEFAULT_COLOR, DEFAULT_FILTER, DEFAULT_PAGE, DEFAULT_SORT, DEFAULT_USERNAME, FILTER_OPTIONS,} from "./dummy-import-2";const handlePage = (pag
Transcript
00:00 Okay, let's go for another world record here. We have a handle page function, which takes in a page, and we're checking if the page is greater than max page. And we've got max page up here, which is being imported from dummy import too, but we're also grabbing a bunch of other stuff here. We could, of course, just delete these manually, but what if we're at the bottom of a thousand line file
00:19 and we want to just prune our imports, make sure that we're not importing anything that we don't need to? Well, there is a way to do it, and it is really, really nice, and it's on a hotkey, and it's beautiful to use. Your job is to try to find it. It's the organize imports command, and just give it a go, see what happens, and I'll see you in the solution.