Skip to content

Commit 134e929

Browse files
authored
Merge pull request #3258 from gregorianrants/patch-6
Update part4a.md
2 parents 493628f + 04ba0ab commit 134e929

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/content/4/en/part4a.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,14 @@ Now the exported "thing" (in this case a router object) is assigned to a variabl
393393
394394
</div>
395395
396+
#### Finding the usages of your exports with VScode
397+
398+
VScode has a handy feature that allows you to see where your modules have been exported. This can be very helpfull for refactoring, say for example you decide to spilt a function in to 2 seperate functions, your code could break if you don't modify all the usages. This is difficult if you dont know where they are. However you need to define your exports in a particular way for this to work.
399+
400+
If you right click on a variable, in the location it is exported from and select find all references it will show you everywhere the variable is imported. However if you assign an object directly to module.exports it will not work. A work around is to assign the object you want to export to a named variable then export the named variable. It also will not work if you destructure where you are importing, you have to import the named variable then destructure or just use dot notation to use the functions contained in the named variable.
401+
402+
The nature of VS code bleeding into how you write your code is probably not ideal, so you need to decide yourself if the trade off is worthwhile.
403+
396404
<div class="tasks">
397405
398406
### Exercises 4.1.-4.2.

0 commit comments

Comments
 (0)