0
React vs html
Hello guys can someone please explain this to me Why in react we shouldn't call a function <button onClick={activateLasers}> But in html <button onClick='activateLasers() '>
2 Answers
+ 7
All of React components have a 'render' function that specifies what the HTML output of React component will be. JSX is a "JavaScript eXtension" that allows us to write JavaScript that 'looks like' HTML.
**When you write JSX, it's really just calling a JavaScript function under the hood.
To see what this means, imagine we had a React component that renders an h1 HTML tag. JSX allows us to declare an element in a manner that closely resembles HTML.
class SoloLearn extends React.Component {
 render() {
   return (
     <h1 className='large'>Welcome to the Road to learn React </h1>
   );
 }
}
Using JSX, the component is easier to understand because it looks like HTML (although is not).
+ 2
Because we use JSX syntax in ReactJS.