Skip to content
Advertisement

React exporting multiple method calling another method error

Currently i am exporting only one funtin like this and it works great

JavaScript

But when I try to export multiple functions, it doesn’t work.

JavaScript

Can anyone tell me why it doesnt work? It works when i do like this

JavaScript

But what’s wrong with it if i put it inside a functin? Can anyone tell me how can i do it?

Advertisement

Answer

You cam simply do this.

JavaScript

Or you can do this.

JavaScript

The below one works as it is considering object’s key and value has the same name. Hence, shorthand.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement