Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react hooks in codepen

/*
   1. Click on "Open js setting" in codepen
   2. Click on "js" under the pen settings
   3. On the right-hand-side, scroll down to "Add External Scripts/Pens"
   4. Search and add "react" or copy and paste the cdn below:
    https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js
   5. Click on "save and close"
   6. Use the following code in your editor.
*/

const { useState, useEffect } = React;

const counter = () => {
	const [counter, setCounter] = useState(25)
    
    return <h1>{counter}</h1>
}

// With love @kouqhar
Source by www.linkedin.com #
 
PREVIOUS NEXT
Tagged: #react #hooks #codepen
ADD COMMENT
Topic
Name
4+5 =