Ways to call the functional component

We can call the functions in javaScript in other ways as follows:

1. Call the function by using the name of the function followed by the Parentheses.

// Example of Calling the function with function name followed by Parentheses
function Parentheses() {
return (<h1>
We can call function using name of the
function followed by Parentheses
</h1>);
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(Parentheses());

2. Call the function by using the functional component method.

// Example of Calling the function using component call
function Comp() {
return (<h1> As usual we can call the function using component call</h1>);
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Comp />);

Now, We will use the functional component method to create a program and see how functional components render the component in the browser.

ReactJS Functional Components

Functional Component is one way to create components in a React Application. React.js Functional Components helps to create UI components in a Functional and more concise way. In this article, we will learn about functional components in React, different ways to call the functional component, and also learn how to create the functional components. We will also demonstrate the use of hooks in functional components

Table of Content

  • Functional components in React :
  • Ways to call the functional component:
  • Problem with using functional components
  • Advantage of using hooks in functional components

Similar Reads

Functional Components in React :

ReactJS Functional components are some of the more common components that will come across while working in React. These are simply JavaScript functions. We can create a functional component in React by writing a JavaScript function. These functions may or may not receive data as parameters. In the functional Components, the return value is the JSX code to render to the DOM tree....

Ways to call the functional component:

We can call the functions in javaScript in other ways as follows:...

Steps to create the React application:

Step 1: Create React Project...

Problem with using functional components

...

Advantage of using hooks in functional components

...

Contact Us