GPT Cards of Guitarists

Learn some tips on prompting, and some awesome guitarists, to create a React app built using TypeScript.

Introduction

I don't know about you, but anytime I can incorporate my own interests into my work or something I'm learning, I'm all in. As a guitarist and performer, I decided to look up some information about some of my favorite guitarists and use it for content in a React application.

In this article, I will show you some tips on prompt engineering and explain how to use ChatGPT to create a React app with TypeScript displaying responsive cards with information about some of the top guitarists.

First Prompt - Guitar Effect Pedals

I started by diving right into ChatGPT. I like doing this because I can find out exactly what data I will be working with while brainstorming some ideas on how to implement them. Here is my first prompt.

Jon:

Create ten guitar effect pedals + Amp setups to sound like the following artists: Santana, Trey Anastasio, Frank Zappa, Wes Montgomery, Charlie Christian, David Bowie, Derek Trucks, Duane Allman, Keller Williams, Me


GPT:

Sure! Here are ten guitar effect pedal and amp setups to help you sound like the mentioned artists, as well as a unique setup for yourself:

  1. Santana:

    • Pedalboard: Wah-Wah, Tube Screamer, Uni-Vibe, Delay, Reverb

    • Amp: Mesa Boogie Mark I

  2. Trey Anastasio (Phish):

    • Pedalboard: Compressor, Tube Screamer, Octave, Phaser, Delay, Reverb

    • Amp: Fender Twin Reverb

  3. Frank Zappa:

    • Pedalboard: Fuzz, Wah-Wah, Envelope Filter, Octave, Flanger, Delay, Reverb

    • Amp: Marshall Plexi

  4. Wes Montgomery:

    • Pedalboard: Compressor, Tube Screamer, Chorus, Delay, Reverb

    • Amp: Roland JC-120 Jazz Chorus

  5. Charlie Christian:

    • Pedalboard: Compressor, Tube Screamer, Vibrato, Delay, Reverb

    • Amp: Fender Deluxe Reverb

  6. David Bowie:

    • Pedalboard: Phaser, Flanger, Synth, Delay, Reverb

    • Amp: Vox AC30

  7. Derek Trucks:

    • Pedalboard: Wah-Wah, Tube Screamer, Boost, Uni-Vibe, Delay, Reverb

    • Amp: Fender Deluxe Reverb

  8. Duane Allman (Allman Brothers Band):

    • Pedalboard: Fuzz, Wah-Wah, Octave, Leslie Rotary Speaker, Delay, Reverb

    • Amp: Marshall JMP Super Lead

  9. Keller Williams:

    • Pedalboard: Acoustic Simulator, Looper, Delay, Reverb

    • Amp: Fishman Loudbox Artist

  10. Your unique setup:

    • Pedalboard: Overdrive, Delay, Reverb, Phaser

    • Amp: Fender Blues Junior

Feel free to experiment with these setups and adjust them to your personal preference. Remember, the key to achieving the desired sound is practice and tweaking the settings to match the specific songs or styles of each artist. Enjoy exploring your musical journey!


Well, I was looking for more specific details like brands and models of pedals. Let's try another prompt:

Prompt 2 - Guitar Effect Pedals Details

Jon:

Revise with the actual brands used by each artist

GPT:

Certainly! Here's a revised list of guitar effect pedals and amp setups, incorporating the actual brands used by each artist:

  1. Santana:

    • Pedalboard: Dunlop Cry Baby Wah, Ibanez TS808 Tube Screamer, Uni-Vibe by Authentic Hendrix, TC Electronic Flashback Delay, Strymon BigSky Reverb

    • Amp: Mesa/Boogie Mark Series

  2. Trey Anastasio (Phish):

    • Pedalboard: Ross Compressor, Ibanez TS9 Tube Screamer, Mu-Tron Octave Divider, Mu-Tron III Envelope Filter, Line 6 DL4 Delay Modeler, Eventide Space Reverb

    • Amp: Mesa/Boogie Mark III or Languedoc G2 Tube Preamp

  3. Frank Zappa:

    • Pedalboard: Fuzz Face, Vox V847 Wah, MXR Phase 90, Electro-Harmonix Electric Mistress Flanger/Filter Matrix, Maestro Echoplex EP-3 Tape Echo, Eventide H9 Harmonizer

    • Amp: Marshall Plexi or Fender Twin Reverb

  4. Wes Montgomery:

    • Pedalboard: Boss CS-3 Compressor, Ibanez TS808 Tube Screamer, Boss CE-1 Chorus Ensemble, Boss DD-7 Digital Delay, Strymon Flint Reverb & Tremolo

    • Amp: Polytone Mini-Brute or Gibson GA-200

  5. Charlie Christian:

    • Pedalboard: Boss CS-3 Compressor, Ibanez TS808 Tube Screamer, Boss CE-1 Chorus Ensemble, Boss DD-7 Digital Delay, Strymon Flint Reverb & Tremolo

    • Amp: Fender Deluxe Reverb or Gibson EH-150

  6. David Bowie:

    • Pedalboard: Electro-Harmonix Small Stone Phaser, Electro-Harmonix Electric Mistress Flanger/Filter Matrix, Moog Minifooger MF-101 Lowpass Filter, Eventide TimeFactor Delay, Strymon BigSky Reverb

    • Amp: Vox AC30 or Roland JC-120 Jazz Chorus

  7. Derek Trucks:

    • Pedalboard: Dunlop Cry Baby Wah, Ibanez TS9 Tube Screamer, Klon Centaur Professional Overdrive, Uni-Vibe by Authentic Hendrix, Eventide TimeFactor Delay, Strymon BigSky Reverb

    • Amp: Fender Deluxe Reverb or Mesa/Boogie Mark V

  8. Duane Allman (Allman Brothers Band):

    • Pedalboard: Dallas Arbiter Fuzz Face, Vox V847 Wah, Electro-Harmonix POG2 Octave Generator, Leslie Rotary Speaker, Maestro Echoplex EP-3 Tape Echo, Eventide Space Reverb

    • Amp: Marshall JMP Super Lead or Fender Deluxe Reverb

  9. Keller Williams:

    • Pedalboard: LR Baggs Venue DI Acoustic Preamp, Boss RC-300 Loop Station, Strymon El Capistan dTape Echo, Strymon BlueSky Reverb

    • Amp: Fishman Loudbox Artist or AER Compact 60

  10. Your unique setup:

    • Pedalboard: Your choice of overdrive pedal (e.g., Ibanez Tube Screamer, Fulltone OCD), Boss DD-7 Digital Delay, Strymon BlueSky Reverb, MXR Phase 90

    • Amp: Fender Blues Junior or Vox AC15

Remember, these are just guidelines based on the known preferences of the artists mentioned. Each artist may have used additional or alternative pedals throughout their career. Feel free to experiment and adapt the setups to your liking.

Okaaay! That is some sweet information bundled nicely into a concise list. Imagine how long it would have taken to replicate this list by searching the web!

So this is nice. But we need to use it as data in a React app. So let's convert this into a JSON object using another prompt (you can go ahead and type it out, but I'll beat ya with GPT!).

NOTE: I also decide to add more information for each guitarist while I'm at it. Why not!!! Check it out:

Jon:

Convert information into a JSON object, and add the following parameters: 'guitars', 'year born', 'bands', 'location', 'genre', 'top 3 songs', and 'influenced by'

GPT:

Certainly! Here's a revised version of the information in a JSON object format, including additional parameters:

{
  "artists": [
    {
      "name": "Santana",
      "yearBorn": 1947,
      "bands": ["Santana"],
      "location": "United States",
      "genre": "Latin rock, blues rock",
      "topSongs": ["Smooth", "Black Magic Woman", "Oye Como Va"],
      "influencedBy": ["B.B. King", "John Coltrane", "Miles Davis"],
      "gear": {
        "guitar": "PRS Santana Signature Model",
        "pedalboard": ["Dunlop Cry Baby Wah", "Ibanez TS808 Tube Screamer", "Uni-Vibe by Authentic Hendrix", "TC Electronic Flashback Delay", "Strymon BigSky Reverb"],
        "amp": "Mesa/Boogie Mark Series"
      }
    },
    {
      "name": "Trey Anastasio",
      "yearBorn": 1964,
      "bands": ["Phish", "Trey Anastasio Band"],
      "location": "United States",
      "genre": "Jam rock",
      "topSongs": ["You Enjoy Myself", "Down with Disease", "First Tube"],
      "influencedBy": ["Grateful Dead", "Frank Zappa", "Miles Davis"],
      "gear": {
        "guitar": "Languedoc Guitars Trey Anastasio Signature Model",
        "pedalboard": ["Ross Compressor", "Ibanez TS9 Tube Screamer", "Mu-Tron Octave Divider", "Mu-Tron III Envelope Filter", "Line 6 DL4 Delay Modeler", "Eventide Space Reverb"],
        "amp": "Mesa/Boogie Mark III"
      }
    },
    {
      "name": "Frank Zappa",
      "yearBorn": 1940,
      "bands": ["Frank Zappa and The Mothers of Invention"],
      "location": "United States",
      "genre": "Experimental rock, jazz fusion",
      "topSongs": ["Peaches en Regalia", "Watermelon in Easter Hay", "Don't Eat the Yellow Snow"],
      "influencedBy": ["Igor Stravinsky", "Edgard Varèse", "Johnny Guitar Watson"],
      "gear": {
        "guitar": "Gibson SG",
        "pedalboard": ["Fuzz Face", "Vox V847 Wah", "MXR Phase 90", "Electro-Harmonix Electric Mistress Flanger/Filter Matrix", "Maestro Echoplex EP-3 Tape Echo", "Eventide H9 Harmonizer"],
        "amp": "Marshall Plexi"
      }
    },
    {
      "name": "Wes Montgomery",
      "yearBorn": 1923,
      "bands": [],
      "location": "United States",
      "genre": "Jazz",
      "topSongs": ["Round Midnight", "Four on Six", "West Coast Blues"],
      "influencedBy": ["Charlie Christian", "Django Reinhardt", "Lester Young"],
      "gear": {
        "guitar": "Gibson L-5 CES",
        "pedalboard": ["Boss CS-3 Compressor", "Ibanez TS808 Tube Screamer", "Boss CE-1 Chorus Ensemble", "Boss DD-7 Digital Delay", "Strymon Flint Reverb & Tremolo"],
        "amp": "Polytone Mini-Brute"
      }
    },
    {
      "name": "Charlie Christian",
      "yearBorn": 1916,
      "bands": [],
      "location": "United States",
      "genre": "Jazz",
      "topSongs": ["Seven Come Eleven", "Air Mail Special", "Till Tom Special"],
      "influencedBy": ["Benny Goodman", "Count Basie", "Lester Young"],
      "gear": {
        "guitar": "Gibson ES-150",
        "pedalboard": ["Boss CS-3 Compressor", "Ibanez TS808 Tube Screamer", "Boss CE-1 Chorus Ensemble", "Boss DD-7 Digital Delay", "Strymon Flint Reverb & Tremolo"],
        "amp": "Fender Deluxe Reverb"
      }
    },
    {
      "name": "David Bowie",
      "yearBorn": 1947,
      "bands": [],
      "location": "United Kingdom",
      "genre": "Rock, pop",
      "topSongs": ["Space Oddity", "Heroes", "Life on Mars?"],
      "influencedBy": ["The Beatles", "Lou Reed", "Iggy Pop"],
      "gear": {
        "guitar": "Gibson Les Paul",
        "pedalboard": ["Electro-Harmonix Small Stone Phaser", "Electro-Harmonix Electric Mistress Flanger/Filter Matrix", "Moog Minifooger MF-101 Lowpass Filter", "Eventide TimeFactor Delay", "Strymon BigSky Reverb"],
        "amp": "Vox AC30"
      }
    },
    {
      "name": "Derek Trucks",
      "yearBorn": 1979,
      "bands": ["Tedeschi Trucks Band", "The Allman Brothers Band"],
      "location": "United States",
      "genre": "Blues rock, Southern rock",
      "topSongs": ["Midnight in Harlem", "Jessica", "Soul Serenade"],
      "influencedBy": ["Duane Allman", "Elmore James", "John Coltrane"],
      "gear": {
        "guitar": "Gibson SG",
        "pedalboard": ["Dunlop Cry Baby Wah", "Ibanez TS9 Tube Screamer", "Klon Centaur Professional Overdrive", "Uni-Vibe by Authentic Hendrix", "Eventide TimeFactor Delay", "Strymon BigSky Reverb"],
        "amp": "Mesa/Boogie Mark V"
      }
    },
    {
      "name": "Duane Allman",
      "yearBorn": 1946,
      "bands": ["The Allman Brothers Band"],
      "location": "United States",
      "genre": "Blues rock, Southern rock",
      "topSongs": ["Statesboro Blues", "Melissa", "Whipping Post"],
      "influencedBy": ["Elmore James", "B.B. King", "Eric Clapton"],
      "gear": {
        "guitar": "Gibson Les Paul",
        "pedalboard": ["Dallas Arbiter Fuzz Face", "Vox V847 Wah", "Electro-Harmonix POG2 Octave Generator", "Leslie Rotary Speaker", "Maestro Echoplex EP-3 Tape Echo", "Eventide Space Reverb"],
        "amp": "Marshall JMP Super Lead"
      }
    },
    {
      "name": "Keller Williams",
      "yearBorn": 1970,
      "bands": [],
      "location": "United States",
      "genre": "Jam rock, folk",
      "topSongs": ["Freaker by the Speaker", "Kidney in a Cooler", "Best Feeling"],
      "influencedBy": ["Grateful Dead", "Kris Kristofferson", "Victor Wooten"],
      "gear": {
        "guitar": "Martin HD-28",
        "pedalboard": ["LR Baggs Venue DI Acoustic Preamp", "Boss RC-300 Loop Station", "Strymon El Capistan dTape Echo", "Strymon BlueSky Reverb"],
        "amp": "Fishman Loudbox Artist"
      }
    },
    {
      "name": "Me",
      "yearBorn": 1990,
      "bands": ["My Band"],
      "location": "Your Location",
      "genre": "Your Genre",
      "topSongs": ["Your Top Songs"],
      "influencedBy": ["Your Influences"],
      "gear": {
        "guitar": "Your Guitar",
        "pedalboard": ["Your Pedals"],
        "amp": "Your Amp"
      }
    }
  ]
}

Please note that the gear information provided for "Me" is left empty as it would depend on your personal preferences and setup. Feel free to fill in the appropriate gear details based on your own equipment.

Now we're talking! This is perfect... AND I'm learning some cool stuff about my favorite guitarists while we're at it! I never know Charlie Christian used a Boss C-3 Compressor! Seems odd since Charlie passed away in 1942, and 44 years later the pedal was released. Hmm.

Don't forget!!! These LLMs are NOT always right. You should tread lightly and have a decent idea of what you are looking for when using it as an educational or professional resource. And it goes without saying, ALWAYS check your facts with other resources.

Anyways, let's roll with it and create another JSON object with the same information for 10 more guitarists:

{
  "artists": [
    {
      "name": "Jimi Hendrix",
      "yearBorn": 1942,
      "bands": ["The Jimi Hendrix Experience"],
      "location": "United States",
      "genre": "Rock, blues",
      "topSongs": ["Purple Haze", "Hey Joe", "All Along the Watchtower"],
      "influencedBy": ["Muddy Waters", "B.B. King", "Elmore James"],
      "gear": {
        "guitar": "Fender Stratocaster",
        "pedalboard": ["Dallas Arbiter Fuzz Face", "Vox Clyde McCoy Wah", "Uni-Vibe by Authentic Hendrix", "Maestro Echoplex EP-3 Tape Echo", "Eventide H9 Harmonizer"],
        "amp": "Marshall Super Lead"
      }
    },
    {
      "name": "Eric Clapton",
      "yearBorn": 1945,
      "bands": ["Cream", "Derek and the Dominos"],
      "location": "United Kingdom",
      "genre": "Blues rock",
      "topSongs": ["Layla", "Wonderful Tonight", "Tears in Heaven"],
      "influencedBy": ["Robert Johnson", "B.B. King", "Albert King"],
      "gear": {
        "guitar": "Fender Stratocaster",
        "pedalboard": ["Ibanez TS808 Tube Screamer", "Dallas Arbiter Fuzz Face", "Roger Mayer Octavia", "Boss DM-2 Delay", "Lexicon PCM70 Reverb"],
        "amp": "Marshall Bluesbreaker"
      }
    },
    {
      "name": "Stevie Ray Vaughan",
      "yearBorn": 1954,
      "bands": ["Double Trouble"],
      "location": "United States",
      "genre": "Blues, blues rock",
      "topSongs": ["Pride and Joy", "Texas Flood", "Little Wing"],
      "influencedBy": ["Albert King", "Jimi Hendrix", "B.B. King"],
      "gear": {
        "guitar": "Fender Stratocaster",
        "pedalboard": ["Ibanez TS808 Tube Screamer", "Dallas Arbiter Fuzz Face", "Uni-Vibe by Authentic Hendrix", "Boss DD-2 Digital Delay", "Lexicon PCM70 Reverb"],
        "amp": "Fender Vibroverb"
      }
    },
    {
      "name": "Jimmy Page",
      "yearBorn": 1944,
      "bands": ["Led Zeppelin", "The Yardbirds"],
      "location": "United Kingdom",
      "genre": "Rock",
      "topSongs": ["Stairway to Heaven", "Whole Lotta Love", "Kashmir"],
      "influencedBy": ["Bert Jansch", "Muddy Waters", "Scotty Moore"],
      "gear": {
        "guitar": "Gibson Les Paul",
        "pedalboard": ["Dallas Arbiter Fuzz Face", "Sola Sound Tone Bender", "MXR Phase 90", "Echoplex EP-3 Tape Echo", "Eventide H9 Harmonizer"],
        "amp": "Marshall Super Lead"
      }
    },
    {
      "name": "Eddie Van Halen",
      "yearBorn": 1955,
      "bands": ["Van Halen"],
      "location": "United States",
      "genre": "Rock",
      "topSongs": ["Eruption", "Jump", "Panama"],
      "influencedBy": ["Eric Clapton", "Jimi Hendrix", "Allan Holdsworth"],
      "gear": {
        "guitar": "Frankenstein (Fender Stratocaster)",
        "pedalboard": ["MXR Phase 90", "MXR Flanger", "Boss DS-1 Distortion", "Roland RE-201 Space Echo"],
        "amp": "Marshall Super Lead"
      }
    },
    {
      "name": "Slash",
      "yearBorn": 1965,
      "bands": ["Guns N' Roses", "Velvet Revolver"],
      "location": "United Kingdom",
      "genre": "Hard rock",
      "topSongs": ["Sweet Child o' Mine", "November Rain", "Welcome to the Jungle"],
      "influencedBy": ["Joe Perry", "Jimmy Page", "Michael Schenker"],
      "gear": {
        "guitar": "Gibson Les Paul",
        "pedalboard": ["MXR Phase 90", "Dunlop Cry Baby Wah", "Boss DD-3 Digital Delay", "MXR Carbon Copy Analog Delay", "Marshall Shredmaster Distortion"],
        "amp": "Marshall JCM 800"
      }
    },
    {
      "name": "John Mayer",
      "yearBorn": 1977,
      "bands": ["John Mayer Trio"],
      "location": "United States",
      "genre": "Pop rock, blues",
      "topSongs": ["Gravity", "Slow Dancing in a Burning Room", "Daughters"],
      "influencedBy": ["Stevie Ray Vaughan", "Eric Clapton", "Jimi Hendrix"],
      "gear": {
        "guitar": "Fender Stratocaster",
        "pedalboard": ["Klon Centaur Professional Overdrive", "Ibanez TS10 Tube Screamer", "Fulltone OCD Overdrive", "Boss DD-7 Digital Delay", "Strymon BigSky Reverb"],
        "amp": "Dumble Steel String Singer"
      }
    },
    {
      "name": "Joe Satriani",
      "yearBorn": 1956,
      "bands": [],
      "location": "United States",
      "genre": "Rock, instrumental rock",
      "topSongs": ["Surfing with the Alien", "Always with Me, Always with You", "Summer Song"],
      "influencedBy": ["Jimi Hendrix", "Eddie Van Halen", "Steve Vai"],
      "gear": {
        "guitar": "Ibanez JS Series",
        "pedalboard": ["Ibanez Tube Screamer", "Boss DS-1 Distortion", "Eventide H9 Harmonizer", "Strymon Timeline Delay", "Strymon BigSky Reverb"],
        "amp": "Marshall JVM410H"
      }
    },
    {
      "name": "B.B. King",
      "yearBorn": 1925,
      "bands": [],
      "location": "United States",
      "genre": "Blues",
      "topSongs": ["The Thrill Is Gone", "Lucille", "Sweet Little Angel"],
      "influencedBy": ["T-Bone Walker", "Lonnie Johnson", "Bukka White"],
      "gear": {
        "guitar": "Gibson ES-355",
        "pedalboard": ["Boss BD-2 Blues Driver", "TC Electronic MojoMojo Overdrive", "TC Electronic Flashback Delay", "TC Electronic Hall of Fame Reverb"],
        "amp": "Lab Series L5"
      }
    },
    {
      "name": "Prince",
      "yearBorn": 1958,
      "bands": ["The Revolution"],
      "location": "United States",
      "genre": "Funk, pop, rock",
      "topSongs": ["Purple Rain", "Kiss", "When Doves Cry"],
      "influencedBy": ["Jimi Hendrix", "James Brown", "Sly Stone"],
      "gear": {
        "guitar": "Symbol Guitar (Hohner MadCat)",
        "pedalboard": ["Boss DS-1 Distortion", "Boss CE-1 Chorus Ensemble", "Boss DD-2 Digital Delay", "Mu-Tron III Envelope Filter", "Lexicon PCM 41 Digital Delay"],
        "amp": "Mesa/Boogie Mark II"
      }
    }
  ]
}

Now let's combine these two objects into the same file and setup our React App:

To set up a new React app from scratch and incorporate TypeScript and Tailwind CSS, you can follow these steps:

  1. Create a new directory for your project and navigate into it:

     mkdir my-react-app
     cd my-react-app
    
  2. Initialize a new npm project:

     npm init -y
    
  3. Install React, ReactDOM, and TypeScript packages as dev dependencies:

     npm install react react-dom --save-dev
     npm install typescript @types/react @types/react-dom --save-dev
    
  4. Initialize TypeScript configuration:

     npx tsc --init
    
  5. Install Tailwind CSS and its dependencies:

     npm install tailwindcss postcss autoprefixer --save-dev
    
  6. Create a tailwind.config.js file by running the following command:

     npx tailwindcss init
    
  7. Open the tailwind.config.js file and add the following line to enable JIT mode:

     module.exports = {
       mode: 'jit',
       // ...
     };
    
  8. Create a postcss.config.js file and add the following content:

     module.exports = {
       plugins: [
         require('tailwindcss'),
         require('autoprefixer'),
       ],
     };
    
  9. Create a src folder in the project root directory and navigate into it:

     mkdir src
     cd src
    
  10. Create an index.tsx file with the following content:

tsxCopy codeimport React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);
  1. Create an App.tsx file with the following content:
import React from 'react';

const App: React.FC = () => {
  return (
    <div className="container mx-auto px-4 py-8">
      <h1 className="text-3xl font-semibold">Hello, React!</h1>
    </div>
  );
};

export default App;
  1. Create an index.html file in the project root directory with the following content:
htmlCopy code<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>My React App</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <div id="root"></div>
    <script src="index.js"></script>
  </body>
</html>
  1. Create a styles.css file in the project root directory with the following content:
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
  1. Open the tsconfig.json file and modify the following properties:
{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "jsx": "react-jsx",
    "strict": true,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "lib": ["dom", "dom.iterable", "esnext"],
    "skipLibCheck": true
  }
}
  1. Add the following scripts to the package.json file:
"scripts": {
  "start": "webpack serve --open",
  "build": "webpack --mode production"
}
  1. Install additional dependencies for bundling and development server:
npm install webpack webpack-cli webpack-dev-server html-webpack-plugin style-loader css-loader postcss-loader babel-loader @babel/core @babel/preset-env @babel/preset-react --save-dev
  1. Create a webpack.config.js file in the project root directory with the following content:
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  entry: './src/index.tsx',
  output: {
    path: `${__dirname}/dist`,
    filename: 'index.js',
  },
  module: {
    rules: [
      {
        test: /\.(ts|tsx)$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env', '@babel/preset-react'],
          },
        },
      },
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader', 'postcss-loader'],
      },
    ],
  },
  resolve: {
    extensions: ['.tsx', '.ts', '.js'],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './index.html',
      filename: 'index.html',
    }),
  ],
};
  1. In the project root directory, run the development server:
npm start
  1. Open your browser and visit http://localhost:8080 to see the "Hello, React!" message rendered.

  2. Install the necessary dependencies:

         npm install axios tailwindcss
    
  3. Create a new TypeScript file (e.g., Guitarists.tsx) and import the required modules:

     import React, { useEffect, useState } from 'react';
     import axios from 'axios';
    
  4. Define the type for the guitarist object:

     type Guitarist = {
       name: string;
       yearBorn: number;
       bands: string[];
       location: string;
       genre: string;
       topSongs: string[];
       influencedBy: string[];
       gear: {
         guitar: string;
         pedalboard: string[];
         amp: string;
       };
     };
    
  5. Create a functional component called Guitarists:

     const Guitarists: React.FC = () => {
       const [guitarists, setGuitarists] = useState<Guitarist[]>([]);
    
       useEffect(() => {
         const fetchData = async () => {
           try {
             const response = await axios.get('/path/to/your/json/file.json');
             setGuitarists(response.data.artists);
           } catch (error) {
             console.log(error);
           }
         };
    
         fetchData();
       }, []);
    
       return (
         <div className="flex flex-wrap justify-center">
           {guitarists.map((guitarist, index) => (
             <div
               key={index}
               className="bg-white rounded shadow-lg m-4 p-6 max-w-xs"
             >
               <h2 className="text-xl font-semibold mb-2">{guitarist.name}</h2>
               <p className="text-gray-600 mb-4">Year Born: {guitarist.yearBorn}</p>
               <p className="text-gray-600 mb-4">Bands: {guitarist.bands.join(', ')}</p>
               <p className="text-gray-600 mb-4">Location: {guitarist.location}</p>
               <p className="text-gray-600 mb-4">Genre: {guitarist.genre}</p>
               <h3 className="text-lg font-semibold mb-2">Top Songs:</h3>
               <ul className="list-disc ml-6">
                 {guitarist.topSongs.map((song, index) => (
                   <li key={index}>{song}</li>
                 ))}
               </ul>
               <h3 className="text-lg font-semibold mt-4 mb-2">Influenced By:</h3>
               <ul className="list-disc ml-6">
                 {guitarist.influencedBy.map((influence, index) => (
                   <li key={index}>{influence}</li>
                 ))}
               </ul>
               <h3 className="text-lg font-semibold mt-4 mb-2">Gear:</h3>
               <p className="text-gray-600 mb-4">Guitar: {guitarist.gear.guitar}</p>
               <p className="text-gray-600 mb-4">
                 Pedals: {guitarist.gear.pedalboard.join(', ')}
               </p>
               <p className="text-gray-600 mb-4">Amp: {guitarist.gear.amp}</p>
             </div>
           ))}
         </div>
       );
     };
    
     export default Guitarists;
    
  6. In your main app component, import the Guitarists component:

     import React from 'react';
     import Guitarists from './Guitarists';
    
     const App: React.FC = () => {
       return (
         <div className="container mx-auto px-4 py-8">
           <h1 className="text-3xl font-semibold mb-6">Guitarists</h1>
           <Guitarists />
         </div>
       );
     };
    
     export default App;
    
  7. Add Tailwind CSS styles by creating a tailwind.css file in your project's root directory:

     @import 'tailwindcss/base';
     @import 'tailwindcss/components';
     @import 'tailwindcss/utilities';
    
  8. Import the tailwind.css file in your index.tsx file:

     tsxCopy codeimport React from 'react';
     import ReactDOM from 'react-dom';
     import './tailwind.css';
     import App from './App';
    
     ReactDOM.render(
       <React.StrictMode>
         <App />
       </React.StrictMode>,
       document.getElementById('root')
     );
    

Remember to replace /path/to/your/json/file.json in Step 3 with the actual path to your JSON file.

Now, when you run your React app, you should see cards for each guitarist with their information styled using Tailwind CSS. Not bad for 5-10 minutes of work :)

Congratulations!

You have set up a new React app with TypeScript and Tailwind CSS from scratch. You can now start building your React components and styling them with Tailwind CSS.

Enjoy and never hesitate to hit me up with questions, comments, jobs, or anything tech related!!! Please ❤️ if you find value and subscribe to the newsletter for more articles about React, Web Development, AI-Language Models (ChatGPT), React Native, Typescript, TailwindCSS, Tutorials, Learning Aids, and more!!!

Jon Christie

jonchristie.net

User