Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Create Phone numbers and Contacts List in ReactJS ?

  • Last Updated : 12 Feb, 2021

We can create a phone number list along with contact names in ReactJS using the following approach. Material UI for React has this component available for us and it is very easy to integrate. Contact List/ Numbers can be shown in List and tabs can be switched to change the state of data.

Creating React Application And Installing Module:

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

Step 1: Create a React application using the following command:

npx create-react-app foldername

Step 2: After creating your project folder i.e. foldername, move to it using the following command:

cd foldername

Step 3: After creating the ReactJS application, Install the material-ui modules using the following command:

npm install @material-ui/core
npm install @material-ui/icons

App.js: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.


import React, { useState } from "react";
import Paper from "@material-ui/core/Paper";
import Tab from "@material-ui/core/Tab";
import Tabs from "@material-ui/core/Tabs";
import PhoneIcon from "@material-ui/icons/Phone";
import PersonPinIcon from "@material-ui/icons/PersonPin";
const App = () => {
  const [value, setValue] = React.useState(0);
  const [myList, setMyList] = useState([
  const handleChange = (event, newValue) => {
    if (newValue == 0) {
      setMyList(["999XXXXXXX", "8575XXXXXX", "99XXXXXXXX"]);
    } else {
      setMyList(["Contact One", "Contact Two", "Contact Three"]);
  return (
        marginLeft: "40%",
          How to Create Phone numbers and 
          Contacts List in ReactJS?
          flexGrow: 1,
          maxWidth: 500,
          aria-label="icon tabs example"
          <Tab icon={<PhoneIcon />} aria-label="phone" />
          <Tab icon={<PersonPinIcon />} aria-label="person" />
export default App;

Step to Run Application: Run the application using the following command from the root directory of the project.

npm start

Output: Now open your browser and go to http://localhost:3000/, you will see the following output.

My Personal Notes arrow_drop_up
Recommended Articles
Page :