![]() |
VOOZH | about |
The useSelect is a custom hook provided by the Rooks package for React. It is a list selection hook that helps select values from a list.
Arguments:
Return Value- Object that contains the following attributes:
Modules Required:
Step 1: Create a React application using the following command:
npx create-react-application demoStep 2: After creating your project folder i.e. demo, move to it using the following command:
cd demoStep 3: Install Rooks from npm.
npm i rooksOpen the src folder and delete the following files:
Project Structure: The project should look like this:
Example: Let's understand the use of this hook by a list example.
Step to Run Application: Run the application using the following command from the root directory of the project:
npm startOutput: Now open your browser and go to http://localhost:3000/, you will see the following output: