{"id":102913,"date":"2020-03-31T07:00:00","date_gmt":"2020-03-31T04:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=102913"},"modified":"2020-03-26T19:15:15","modified_gmt":"2020-03-26T17:15:15","slug":"reactjs-button-component-example","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html","title":{"rendered":"ReactJS Button Component Example"},"content":{"rendered":"<p>In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development. We use it here to display its prowess when it comes to building flexible and reusable, batteries included, components for front end development.<\/p>\n<p>The approach we use here is applicable to the development of all types of components using ReactJS. We cover styling and functionality which will make it flexible enough to be used in different scenarios with ease.<\/p>\n<p>Let&#8217;s get started!<\/p>\n<h2 class=\"wp-block-heading\">1. Tools and Technologies<\/h2>\n<p>For the example component we build in this article I have used the following:<\/p>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.npmjs.com\/package\/create-react-app\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"create-react-app package (opens in a new tab)\">create-react-app package<\/a><\/li>\n<li><a href=\"https:\/\/reactjs.org\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"ReactJS (opens in a new tab)\">ReactJS<\/a><\/li>\n<li><a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Visual Studio Code IDE (opens in a new tab)\">Visual Studio Code IDE<\/a><\/li>\n<\/ul>\n<p>create-react-app is a package that quickly generates a barebones ReactJS application. We use it as the starting point for our example. It uses and pulls down the latest version of ReactJS. Visual Studio Code is my favorite IDE for front end development and it is free. Although you are free to follow along in any editor or IDE of your choice.<\/p>\n<h2 class=\"wp-block-heading\">2. Application Structure<\/h2>\n<p>Now to start off we run the below command to generate our initial application structure:<\/p>\n<pre class=\"brush: bash;\">&gt;npx create-react-app my-app\n<\/pre>\n<p>npx is a tool that comes with more recent versions of NodeJS. It downloads a temporary copy of the specified package and executes it with supplied arguments. This prevents the pollution of global package space with less frequently used tools. This command generates the application structure that should look like below:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"297\" height=\"617\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Project-Structure-Button-Component.jpg\" alt=\"ReactJS Button Components - Project Structure\" class=\"wp-image-103446\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Project-Structure-Button-Component.jpg 297w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Project-Structure-Button-Component-144x300.jpg 144w\" sizes=\"(max-width: 297px) 100vw, 297px\" \/><figcaption>Project Structure<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\">3. Button Component<\/h2>\n<p>Now that we are set up let us start off creating our Button component. We do so in a file named Button.js and place the corresponding styles in the file named Button.css.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3 class=\"wp-block-heading\">3.1 Style Options<\/h3>\n<p>Our component will support the following styling props:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Size<\/em><\/span><\/p>\n<p>This setting takes the values of either small or large. Which refers to a size smaller than normal or larger than a normal button. <\/p>\n<p><span style=\"text-decoration: underline\"><em>Type<\/em><\/span><\/p>\n<p>This setting takes values of info, danger, and success. Each has a corresponding background-color.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Border<\/em><\/span><\/p>\n<p>This setting takes the value of no-outline, outline, and round. With corresponding behavior applied. <\/p>\n<p><span style=\"text-decoration: underline\"><em>Shadow<\/em><\/span><\/p>\n<p>This setting applies a shadow to the button if present and true else no shadow is rendered.<\/p>\n<p>The CSS to apply the above effects to our component looks like below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Button.css<\/em><\/span><\/p>\n<pre class=\"brush: css;\">.shadow {\n  box-shadow: 0px 3px 5px #aaaaaa;\n}\n.small {\n  font-size: 0.75rem;\n}\n.large {\n  font-size: 1.45rem;\n}\n.outline {\n  border: 1px solid black;\n  background-color: white;\n  color: black;\n}\n.no-outline {\n  border: none;\n}\n.danger {\n  background-color: crimson;\n  color: whitesmoke;\n}\n.info {\n  background-color: blue;\n  color: whitesmoke;\n}\n.success {\n  background-color: green;\n  color: whitesmoke;\n}\n.text-color {\n  color: whitesmoke;\n}\n.round {\n  border-radius: 4px;\n  border: 1px solid lightgrey;\n}\n\n<\/pre>\n<h3 class=\"wp-block-heading\">3.2 Button Component Implementation<\/h3>\n<p>Now that we have our styling stuff set up we write our component. The component renders an HTML button tag with appropriate classes supplied via props to our component. The code for our component looks like below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Button.js<\/em><\/span><\/p>\n<pre class=\"brush: js;\">import React, { useEffect, useState } from \"react\";\nimport \".\/Button.css\";\nfunction Button(props) {\n    const [classes, setClasses] = useState('');\n    const { size, type, border, shadow } = props;\n    useEffect(() =&gt; {\n        let cls = '';\n        if (size) {\n            cls = `${cls} ${size}`;\n        }\n        if (type) {\n            cls = `${cls} ${type}`;\n        }\n        if (border) {\n            cls = `${cls} ${border}`;\n        }\n        if (shadow) {\n            cls = `${cls} shadow`;\n        }\n        setClasses(`${cls}`);\n    }, [size, border, type, shadow]);\n\n    return &lt;&gt;\n        &lt;span&gt;{\n            `Size: ${props.size}, \n             Shadow: ${props.shadow},\n             Type: ${props.type}, \n             Border: ${props.border}`\n        }&lt;\/span&gt;\n        &lt;button className={classes} {...props}&gt;&lt;\/button&gt;\n    &lt;\/&gt;;\n}\n\nexport default Button;\n<\/pre>\n<h2 class=\"wp-block-heading\">4. Using our Button Component<\/h2>\n<p>This wraps up our Button Component, let us now use it to see it in action. We modify the auto-generated index.js file to use our Button component. The modified code for the index.js file is as below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>index.js<\/em><\/span><\/p>\n<pre class=\"brush: js;\">import React from 'react';\nimport ReactDOM from 'react-dom';\nimport '.\/index.css';\nimport Button from '.\/Button';\nimport * as serviceWorker from '.\/serviceWorker';\n\nconst sayHello = () =&gt; {\n  alert('Hello from JCG!');\n}\n\nReactDOM.render(\n  &lt;React.StrictMode&gt;\n    &lt;div className='center-content'&gt;\n      &lt;Button onClick={sayHello} shadow=\"true\" type=\"info\" \nborder=\"round\" size=\"small\"&gt;Hello!&lt;\/Button&gt;\n      &lt;Button onClick={sayHello} type=\"danger\" border=\"round\" \nsize=\"small\"&gt;Hello!&lt;\/Button&gt;\n      &lt;Button onClick={sayHello} shadow=\"true\" type=\"info\" \nborder=\"outline\" size=\"large\"&gt;Hello!&lt;\/Button&gt;\n      &lt;Button onClick={sayHello} type=\"danger\" border=\"no-outline\" \nsize=\"large\"&gt;Hello!&lt;\/Button&gt;\n      &lt;Button onClick={sayHello} shadow=\"true\" type=\"success\" \nborder=\"round\"&gt;Hello!&lt;\/Button&gt;\n      &lt;Button onClick={sayHello} type=\"info\" \nborder=\"round\"&gt;Hello!&lt;\/Button&gt;\n\n    &lt;\/div&gt;\n  &lt;\/React.StrictMode&gt;,\n  document.getElementById('root')\n);\n\n\/\/ If you want your app to work offline and \n\/\/ load faster, you can change\n\/\/ unregister() to register() below. \n\/\/ Note this comes with some pitfalls.\n\/\/ Learn more about service workers:\n\/\/ https:\/\/bit.ly\/CRA-PWA\nserviceWorker.unregister();\n\n<\/pre>\n<p>Let us now run the application and see our Button component in action. We run the below command to launch the application in the default browser. The results look like below:<\/p>\n<pre class=\"brush: bash;\">&gt;npm start\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"951\" height=\"738\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Project-Output-Button-Component.jpg\" alt=\"ReactJS Button Components - Project Output\" class=\"wp-image-103456\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Project-Output-Button-Component.jpg 951w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Project-Output-Button-Component-300x233.jpg 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Project-Output-Button-Component-768x596.jpg 768w\" sizes=\"(max-width: 951px) 100vw, 951px\" \/><figcaption>Project Output<\/figcaption><\/figure>\n<\/div>\n<p>This wraps up our example on creating a ReactJS Button Component.<\/p>\n<h2 class=\"wp-block-heading\">5. Download the Source Code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/JCG-ReactJS-Button-Component-Example.zip\"><strong>ReactJS Button Component Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development. We use it here to display its prowess when it comes to building flexible and reusable, batteries included, components for front end development. The approach we use here is applicable &hellip;<\/p>\n","protected":false},"author":82952,"featured_media":92051,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1903],"tags":[1919],"class_list":["post-102913","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-react-js","tag-reactjs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ReactJS Button Component Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ReactJS Button Component Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-31T04:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/react-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Siddharth Seth\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Siddharth Seth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html\"},\"author\":{\"name\":\"Siddharth Seth\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/09c54717e2cc7956aa8a2df61330f18c\"},\"headline\":\"ReactJS Button Component Example\",\"datePublished\":\"2020-03-31T04:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html\"},\"wordCount\":532,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/react-logo.jpg\",\"keywords\":[\"Reactjs\"],\"articleSection\":[\"React.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html\",\"name\":\"ReactJS Button Component Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/react-logo.jpg\",\"datePublished\":\"2020-03-31T04:00:00+00:00\",\"description\":\"In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/react-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/react-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/reactjs-button-component-example.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\\\/javascript\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"React.js\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\\\/javascript\\\/react-js\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"ReactJS Button Component Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/09c54717e2cc7956aa8a2df61330f18c\",\"name\":\"Siddharth Seth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"caption\":\"Siddharth Seth\"},\"description\":\"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/siddharth-seth-240180\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/siddharth_seth1980\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ReactJS Button Component Example - Java Code Geeks","description":"In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html","og_locale":"en_US","og_type":"article","og_title":"ReactJS Button Component Example - Java Code Geeks","og_description":"In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development.","og_url":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-03-31T04:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/react-logo.jpg","type":"image\/jpeg"}],"author":"Siddharth Seth","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Siddharth Seth","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html"},"author":{"name":"Siddharth Seth","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/09c54717e2cc7956aa8a2df61330f18c"},"headline":"ReactJS Button Component Example","datePublished":"2020-03-31T04:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html"},"wordCount":532,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/react-logo.jpg","keywords":["Reactjs"],"articleSection":["React.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html","url":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html","name":"ReactJS Button Component Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/react-logo.jpg","datePublished":"2020-03-31T04:00:00+00:00","description":"In this article, we build a reusable ReactJS Button Component. ReactJS has grown in popularity and has become the go-to library for front end development.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/react-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/react-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/reactjs-button-component-example.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/www.javacodegeeks.com\/category\/web-development"},{"@type":"ListItem","position":3,"name":"JavaScript","item":"https:\/\/www.javacodegeeks.com\/category\/web-development\/javascript"},{"@type":"ListItem","position":4,"name":"React.js","item":"https:\/\/www.javacodegeeks.com\/category\/web-development\/javascript\/react-js"},{"@type":"ListItem","position":5,"name":"ReactJS Button Component Example"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/09c54717e2cc7956aa8a2df61330f18c","name":"Siddharth Seth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","caption":"Siddharth Seth"},"description":"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.","sameAs":["https:\/\/www.linkedin.com\/in\/siddharth-seth-240180\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/siddharth_seth1980"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/102913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/82952"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=102913"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/102913\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/92051"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=102913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=102913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=102913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}