Skip to content

1337WebDev/react-talk-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReactJS Hooks

useRandomColor

This hook uses the useState hook to create a color state variable, which starts out as an empty string. It also defines two functions:

getRandomColor: This generates a random color by selecting six random characters from a string of hexadecimal digits.

changeColor: This sets the color state variable to a random color by calling getRandomColor.

The hook returns an array that includes the current color value and the changeColor function.

About

React Hooks live coding session examples

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors