Write code to render a button in React JS Last Updated : 12 Dec, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report React is a UI library. It renders components written in JSX. You can build and render any components as per your usage. In this article, we will see how to render a button in React JS. Prerequisites:NodeJS or NPMReact JSJSX SyntaxApproach to render a button: Let us create a React project and a UI that renders a button. Users can interact with the UI and click on the button to trigger an event through this. It features a button in the display that, upon clicking, activates the call method to show an alert with the message "Welcome to Geeks for Geeks!" This component is exported as the default, ready for use elsewhere in the application. Steps to Create the React Application:Step 1: To create a react app, install react modules through npx command. npx create-react-app project_nameStep 2: After creating your react project move into the folder to perform different operations. cd project_nameProject Structure: Project StructureThe updated dependencies in package.json file will look like: "dependencies": { "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "web-vitals": "^2.1.4", }Example: We will create an button that sends a Welcome message i.e. Alert whenever you click the button. JavaScript import React from "react"; class App extends React.Component { call() { alert("Welcome to Geeks for Geeeks!"); } render() { // Rendering a button return ( <button onClick={this.call}>Click the button!</button> ); } } export default App; Step to Run the application: Open the terminal and type the following command. npm startOutput: localhost running on http://localhost:3000 Comment More infoAdvertise with us Next Article React Suite Button Component N namankedia Follow Improve Article Tags : Web Technologies ReactJS React-Questions Similar Reads How to Disable a Button in React JS ? Disabling a button in React JS means making it unclickable and visually indicating its unavailability. This is done by setting the button's disabled attribute to true. It's used for controlled interactions, like form submissions with valid data.A disabled button becomes unclickable and visually sign 4 min read React Suite Loading Button React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The Button component is used to fire an action when the user clicks on it. In this article, we will be seeing React Suite Loading button. The loading button is 3 min read How to Create a Button in Material UI ? Material UI provides a simple and effective way to create buttons in React applications. These offer a sleek and responsive user interface element for various interactions. Installation// Package containing Material UI components including buttons.npm install @mui/materialApproachImport the Button c 1 min read React Suite Button Icon React Suite Button Icon allows to use of an Icon as a Button. The Button component is used to fire an action when the user clicks the button. React Suite Button IconButton Icon component is used when we want to use an icon as a button, It has an icon property that is used to specify the icon of the 3 min read React Suite Button Component React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Button Component allows the user to take actions, and make choices, with a single tap. We can use the following approach in ReactJS to use the React Suite Button 3 min read React Desktop Windows Button Component React Desktop is a popular library to bring the native desktop experience to the web. This library provides macOS and Windows OS components. Button Component is used to allow the users to take actions, and make choices, with a single tap. We can use the following approach in ReactJS to use the React 2 min read Like