Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Named export withRouter()

I want to export the components withRouter() but I need it to be named without the default

export default withRouter(TopNav); 

I've tried

export {TopNav} withRouter(TopNav); 

The error I get from the linter is...

Use of default exports is forbidden (no-default-export)tslint(1) is there a way name the export?

like image 975
Bill Avatar asked May 21 '26 04:05

Bill


1 Answers

Named exports have to be declared so you can do something like this:

export const TopNavWithRouter = withRouter(TopNav);
like image 137
ZekeDroid Avatar answered May 22 '26 22:05

ZekeDroid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!