Skip to main content
InterviewHubPRO
Section Overview
Q346

Question 346 of 407

Part 9: React Hooks Deep Dive (262 - 316)

85%
React Core & Hooks (407 Qs)•Part 9: React Hooks Deep Dive (262 - 316)

What is the recommended way for naming components?

junior LevelCode ExampleComponentsHooks

It is recommended to name the component by reference instead of using displayName.

go
Using `displayName` for naming component:
javascript
    export default React.createClass({
      displayName: "TodoApp",
      // ...
    });
markdown
The **recommended** approach:
javascript
    export default class TodoApp extends React.Component {
      // ...
    }
also
javascript
    const TodoApp = () => {
      //...
    };
    export default TodoApp;