Question
In the context of this lesson, can we declare multiple components in a single file?
Answer
Yes, you can declare multiple components within a single file. For example, there can be a file containing the following components,
class Class1 extends React.Component {
render() { ... }
};
class Class2 extends React.Component {
render() { ... }
};
Choosing to have multiple components in a file or only one component per file can be up to preference. However, keeping classes in separate files can be preferred for the sake of organization.