Posts

Showing posts from January, 2024

Render method in JSX

 The render method must use only one root element. ex: class App extends Component { render ( ) { return ( < div > < h1 > Welcome to Our Application </ h1 > < ForEducators /> </ div > ); } } Note how the <ForEducators/> component/tag is used within the root element div 

react vs javascript function naming conventions

 React - Pascal Case/Upper Camel Case                       EX: ForEducators Javascript - Camel case start              EX: forEducators

Default import can be called with an arbitrary name on Javascript

 Today I made an effort to learn some Javascript from Firstbyte's code. I learned about the purpose of the export statement.   The export default ForEducators ; is a statement written to export the function "ForEducators" in a default mode onto other files AKA module. When importing "ForEducators" into other modules, the default state of the import statement allows us to use any arbitrary name while calling  Example:  import EducatorComponent from './forEducators' ; Here "EducatorComponent" is the arbitrary value that calls the "ForEducators" function from the forEducators module/file. File name: forEducators.js import React from "react" ; function ForEducators () { //function name can start with an uppercase or be camel case   return (     < h1 >       Hello World!!     </ h1 >   ); } export default ForEducators ;