Created
April 12, 2019 07:26
-
-
Save nsisodiya/346196b4a86d00ba96864c5ab2c01a11 to your computer and use it in GitHub Desktop.
React Hooks code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function App() { | |
| // Declare a new state variable, which we'll call "count" | |
| var _useState = Object(react__WEBPACK_IMPORTED_MODULE_1__["useState"])(20), | |
| _useState2 = Object(_Users_narendrasisodiya_rivigoCode_test_my_app_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_useState, 2), | |
| count = _useState2[0], | |
| setCount = _useState2[1]; | |
| return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { | |
| __source: { | |
| fileName: _jsxFileName, | |
| lineNumber: 6 | |
| }, | |
| __self: this | |
| }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("p", { | |
| __source: { | |
| fileName: _jsxFileName, | |
| lineNumber: 7 | |
| }, | |
| __self: this | |
| }, "You clicked ", count, " times"), react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("button", { | |
| onClick: function onClick() { | |
| return setCount(count + 1); | |
| }, | |
| __source: { | |
| fileName: _jsxFileName, | |
| lineNumber: 8 | |
| }, | |
| __self: this | |
| }, "Sonal Click me")); | |
| } | |
| function SuperApp(params) { | |
| return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(App, { | |
| __source: { | |
| fileName: _jsxFileName, | |
| lineNumber: 13 | |
| }, | |
| __self: this | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| function App() { | |
| // Declare a new state variable, which we'll call "count" | |
| const [count, setCount] = useState(20); | |
| return ( | |
| <div> | |
| <p>You clicked {count} times</p> | |
| <button onClick={() => setCount(count + 1)}>Sonal Click me</button> | |
| </div> | |
| ); | |
| } | |
| function SuperApp(params) { | |
| return <App />; | |
| } | |
| export default SuperApp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment