Inspiration

I wanted to complete the challenge Create a Random Number Generator and set my solution within a React application to practice working with this JavaScript framework.

What it does

This application accepts a number from the user. The number is used to set a maximum number which is used when generating a random number.

How we built it

I created a React application, and created form elements to take input from the user and output the result of a randomly generated number. I used the Math.random class from JavaScript to generate the random element, and multiplied this result by the maximum number provided by the user. Finally 1 is added to the result so that the range of results can start from 1.

Challenges we ran into

I am new to working with React so handling the state changes was not intuitive. I wanted to provide suitable error feedback to the user, so produced a solution that presents the random number or an instruction to the user in a readonly field.

Accomplishments that we're proud of

I created a working random number generator. I was able to give this a user set maximum number.

What we learned

I learned more about how form elements are used in React.

What's next for Random Number Generator

I would like to work in a user set minimum number.

Built With

Share this project:

Updates