1
I was preparing a component whose only function was to export a tag <p>
containing a text. I naturally created a function that exported the text:
import React from 'react';
function textoSobre() {
return (
<p>
Insira aqui o texto da aba SOBRE NÓS
</p>
)
}
export default textoSobre
Next I called the function as a tag within a component responsible for the whole section sobre
of the site, which in turn was rendered on App.jsx
import React from 'react';
import './Sobre.css';
import textoSobre from './texto/textoSobre.jsx'
export default props => (
<>
<header className="Sobre">
<h1>Sobre Nós</h1>
</header>
<body>
<textoSobre></textoSobre> {/* aqui chamo a função criada, como uma tag */}
</body>
</>
)
However, when saving the changes and checking the behavior of the application within the browser, I noticed that nothing had changed. After checking the syntax, the relation between the components and the terminal in search of execution errors, I found nothing. I decided to rename the function to Lero
instead of the old textoSobre
. So, it just replaces all the textoSobre
for Lero
and it worked perfectly.
Why does this happen?
the standard used by
React
is Pascal Case as mentioned, but, is not a must is a way to create components to differentiate from other code and maintenance be easier.– novic
If it’s not mandatory, why doesn’t it work when I use Camel case?
– yoyo