Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dineshdeveloper1/87a109ccab73ed687260b3371765aa74 to your computer and use it in GitHub Desktop.
Save dineshdeveloper1/87a109ccab73ed687260b3371765aa74 to your computer and use it in GitHub Desktop.
React Stateless Functional Component
//stateless functional Component =========================================================================================
//without arrow function *************
function Hello(props){
return (
<>
<h1>Hello, {props.name}</h1>
</>
)
};
export default Hello;
//with arrow function ****************
const Hello = (props) => (
<>
<h1>Hello, {props.name}</h1>
</>
);
export default Hello;
// function export within function ***************
export const Hello = (props) => (
<div>
<h1>Hello, {props.name}</h1>
</div>
);
import {Hello} from './Hello //import component with in {}
// example ***************************************************
function Hello(props){
return (
<>
<h1>Hello, {props.name}, {props.location}</h1>
</>
)
};
export default Hello;
<Tool name="Sunday School" location="Bangalore"/>
// ==========================================================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment