how to change font size in react js?

Hi Friends 👋,

Welcome To aGuideHub! ❤️

Today, I am going to show you. how to change font size in react js with code example.

To change font size, put the style={{ fontSize: 50 }} css to change font size, it will change font zize 50 px.

In this article, we will change font size in react js just like you would create in a normal HTML project. Also, we will style it using normal CSS.

Let’s look at the following example to understand how it basically works:

APP.js

import React, { useState } from 'react';
import "./App.css"
const App = () => {

  return (
    <div>
      <h1>aGuidehub</h1>
      <h1 style={{ fontSize: 50 }}>aGuidehub</h1>
      
    </div>
  )
}

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:

Check the output of the above code example.

React, Font, Size

All the best 👍

Follow me on Twitter