Raúl Sánchez Posted on Jul 30, 2021 2 Named Imports/Exports for React Components #react #javascript #namedimports #namedexports Why named imports/exports? Easier to find references to components Autocomplete Prevents typos What does a named import look like? import { Counter } from './Counter'; Enter fullscreen mode Exit fullscreen mode What does a default import look like? import Counter from './Counter'; Enter fullscreen mode Exit fullscreen mode How to export a connected component? export const _Counter () => { ... } export const Counter = compose( withRouter, connect(mapStateToProps, mapDispatchToProps) )(_Counter); Enter fullscreen mode Exit fullscreen mode Top comments (0) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)