0
I’m studying Reactjs, and in the course I’m doing the teacher varies between class and arrow function, my doubt is, where the name of Function comes from?
Example:
When we create a component in React using class we define it as follows
import React, { Component } from 'react';
class Componente extends Component {
render(){
return(
<div>
<h1>Componente</h1>
</div>
)
}
}
export default Componente;
There we define in the
export default the name of the component, and to use the component we use its tag <Componente />
Arrow Function
import React from 'react';
export default props => (
<div>
<h1>Componente</h1>
</div>
)
But when we create a Arrow Function where this name comes from to use in the tag since we didn’t define it in export default?
You give the name of the component when using
import NOME_DO_COMPONENTE from './component_file'.– Valdeir Psr
The name defined in the creation is irrelevant, what matters is the name defined in the import
import UmNomeQualquer from './MeuComponente;– Costamilam