FrontendDeveloper.in

React question detail

What is the recommended way for naming components?

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

Using displayName for naming component:

export default React.createClass({
displayName: "TodoApp",
// ...
});

The recommended approach:

export default class TodoApp extends React.Component {
// ...
}

also

const TodoApp = () => {
//...
};
export default TodoApp;
Back to all React questions
Get LinkedIn Premium at Rs 399