0

while exporting components in react we use "export default objectName", why cant we just write "export objectName" without default keyword ?

class App extends Component { render() { return ( ); } }

export App;

Drew Reese
  • 165,259
  • 14
  • 153
  • 181
  • The correct syntax would be `export class App extends Component {}` or `class App extends Compontent {}; export { App }`. And of course that'll create a named export which you have to import differently. – Bergi May 19 '21 at 10:16
  • So basically it is a syntax, that we should follow, correct ? – kiranmai May 26 '21 at 16:05
  • Yes, it's the correct syntax. – Bergi May 26 '21 at 16:51

0 Answers0