RESTful APIs :Build a BookSearch App -Ver 2.0

Build a BookSearch App without Custom Hook

Initial Steps

  1. Create vite+react project

// Create Vite+React Project
$npm create vite@latest
>Project name : bookshelf
>Select a framework: >React
>Select a variant: >JavaScript
$cd bookshelf
  1. Open the project with visual studio code and add a few dependencies

// Open the project
$code .
inside of vscode terminal
$npm install
$npm install bootstrap
$npm run dev
  1. Open App.jsx and add the following library at top area.

import 'bootstrap/dist/css/bootstrap.min.css';
  1. Open index.html and add third-party stylesheet bootstrap as shown below:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Book Shelf</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="module" src="/src/main.jsx"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">

  </body>
</html>
  1. Test and check the BookShelf App by invoking the following:

// inside of vscode terminal
$npm run dev
  1. Before we start making a new component, open App.jsx file and delete initial code created when initiated the new project except for the main App() function block.

// App.jsx template

/** @format */

/**
 * NOTE:::
 * This is the code that would go into the project's main App.jsx
 * I put it here so that the main App.jsx is clean
 * as we are building other, small components throughout the
 * course.
 *
 */

import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import { useState } from 'react';

```javascriptreact
function App() {
...
  return (
  <>
  ...
  </>
  )
}
export default App;

Last updated