javascript - Why does using react-router-dom necessitate an import of two separate aliases of the same package? -


this import comes react router docs:

import { browserrouter router, route } 'react-router-dom'

i'm not sure whether i'm misunderstanding react here, or js import. seems me imports single package , makes same package available under 2 separate aliases, <router> , <route> components different things , don't seem same in way. what's going on here? <router> , <route> same thing or different?

you're importing 2 different modules same package. react-router-dom exports link, route, , browserrouter modules, , each provides different functionality. es6 style module import statement brings in route , browserrouter, , aliases browserrouter router.

here's brief primer on module imports: https://developer.mozilla.org/en-us/docs/web/javascript/reference/statements/import


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -