How to create a Blog app using ReactJS?


How to create a Blog app using ReactJS?

Before you end up diving deep learning about how to create a blog app using reactJS you need to firstly know what reactJS is all about. ReactJS is basically an open-source JavaScript library that is used for building awesome user interfaces for the front end of the website. Additionally, reactJS is also prominent for declarative component based and learn once write anywhere in code.

under this article you can learn everything about creating A blog app using reactJs. Firstly you can learn about how to create the project name MY APP by entering all the commands NPX create react app my app and install the modules. Then you have to create the folder name component under SRC and just make two JSX files post. Jsx and posts. JSX. You can also add this styling element JSX component by post.CSS and posts.CSS. Lastly you have to import the element into the apps. JS and style into the main app.CSS.

Major components of building A blog with reactJS


it is the major element of the app, and it uses browser router to link all the different pages and give them parts and components to load for that page


It is the home page of the blog website and would show all the blogs in the list format. It does not contain the logic to display the blogs in the list format, but it calls the blog list element and passes in some blogs to that component to display the blogs. The home component will fetch the blog using use fetch custom hook. It is the element to display the home page of the blog website.


This element receives the blocks from the home component and also displays them.


This is where you would create some new blogs and add them to the previous blog list.


It is basically the navbar element that would display the NAV bar on each page.


It is the page that would load if the user lands on a page which does not exist.


It is the default file which will load up the app file.

Steps to create a blog app using reactjs

Step one

you have to create your react project

npx create-react-app blog-app

cd blog-app

Step two

Now the entry point of the application would be app.JS where in the header you have to import the CSS file and import react. You can create that through node package manager. You have imported the post that you have created for writing all the blogs in the bloglist component


import React from "react";

import "./App.css";


import Home from "./components/home";


const App = () => {

  return (

          <Home />




export default App;


Step three

The next step is to make component folder insider SRC and come up with two files known as home and bloglist in it. You already created bloglist component and now we are importing it into home component and we are passing objects of array named blogs to bloglist component.

import React from 'react'

import blogs from '../content/blogs'

import BlogList from './bloglist'


const Home = () => {

    return (

        <div className="main-container">

            <h1 className="main-heading">

                Blog App using React Js


            <BlogList blogs={blogs} />





export default Home;


step four

Adding style to bloglist. Js and for the blog posts here you need to design the skeleton of the article where you have to add the style for the body and .post container inside the style tag


import React from 'react'

import './bloglist.css'


const BlogList = ({ blogs }) => {

    return (



                blogs.length > 0 &&, i) => (

                    <div className="post-container" key={`blog-i-${i}`}>

                        <h1 className="heading">{blog.title}</h1>

                        <img className="image" src={blog.imgUrl} alt="post" />


                        <div className="info">

                            <h4>Written by: {}</h4>









export default BlogList;


Step Five

We have already created an array of objects in the home. Js and now we import them using jsx expression including name of the blog post author name article content last image URL.

Step six

So, after calling the JSX expression there is a need to style the element for showing the article that we have already created. bloglist.css is a container of the POS that is used to set the body post. And heading we post the heading of the post and then set the width and height of the image as per the screen



body {

    background-color: #0e9d57;


.posts-container {

    display: flex;

    justify-content: center;

    align-items: center;



Step seven

It is high time for us to open the terminal and run the project command.


npm start


These are the steps you can consider using if you want to create a blog app by using reactJS. There are different scripts available you can choose the one which runs perfectly with your system