Why would I want to use the
export keyword to export a variable as soon as it’s declared instead of exporting named exports at the bottom of my file?
The choice to export a variable as soon as it’s declared or as a named export at the bottom of the file is based on personal preference.
You may find one way of exporting easier to read than another. For example, say you have many variables you need to export - exporting all of the variables at the bottom of the file may make it easier to see the all the variables that are being exported. On the other hand, say you only have a couple variables you need to export, you may want to export the variable when declared as to not clutter your file unnecessarily.