syntax

import React from 'react';
class App extends React.Component {
render() {
return (
<div>
<h1>Header</h1>
<h2>Content</h2>
<p>This is the content!!!</p>
</div>
);
}
}
export default App;

when i check other sources i see the import statement at the beginning of a component . must i alwyas do that? it does not seem to be in the first part of the book. also what is the purpose of expor default statement? is there an alternative syntax for the export default statement in the book?

The first part of book simplifies the early days of learning about React by allowing you to reference a JavaScript file that is more familiar to many developers. I evolve that later to use a build-approach where you reference a module containing the React files. The import and export statements are a consequence of that more advanced approach that is going to be how you will typically use React in production or real-world scenarios outside of learning :slight_smile: