Giter Site home page Giter Site logo

bklieger / claude-react-jumpstart Goto Github PK

View Code? Open in Web Editor NEW
38.0 3.0 6.0 240 KB

๐Ÿ“– A step-by-step guide for beginners to running Claude-generated React code locally.

License: MIT License

JavaScript 86.08% HTML 1.89% CSS 12.02%
ai artifacts claude react vite claude-artifacts

claude-react-jumpstart's Introduction

License

Claude React Artifact Tutorial

Claude recently released Artifacts, which can compile code in a dedicated window. This tutorial helps beginners set up a React app to any React run code generated by Claude's Artifacts feature.

Project Demo

Claude-React-Jumpstart: A step-by-step guide to running Claude-generated React code locally.


Getting Started

You can use the example provided to learn the process. Before beginning the following steps, remove the my-app folder so you can recreate it.

Step 1: Create new React app with Vite

npm create vite@latest my-app
โœ” Select a framework: โ€บ React
โœ” Select a variant: โ€บ JavaScript
cd my-app
npm install

Step 2: Install Tailwindcss and Shadcn

From instructions: https://ui.shadcn.com/docs/installation/vite

npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

Update vite.config.js:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
})

Create jsconfig.json:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["src/**/*"]
}
npx shadcn-ui@latest init
โœ” Would you like to use TypeScript (recommended)? no
โœ” Which style would you like to use? โ€บ Default
โœ” Which color would you like to use as base color? โ€บ Slate
โœ” Where is your global CSS file? โ€ฆ src/index.css
โœ” Would you like to use CSS variables for colors? โ€ฆ yes
โœ” Are you using a custom tailwind prefix eg. tw-? (Leave blank if not) โ€ฆ
โœ” Where is your tailwind.config.js located? โ€ฆ tailwind.config.js
โœ” Configure the import alias for components: โ€ฆ @/components
โœ” Configure the import alias for utils: โ€ฆ @/lib/utils
โœ” Are you using React Server Components? โ€ฆ no
โœ” Write configuration to components.json. Proceed? โ€ฆ yes

3. Install Other Libraries and Components

Choose your list of required components and libraries to download based upon the imports in your react file.

npx shadcn-ui@latest add card button input
npm install lucide-react

4. Add Your Artifact Code

LLMModel.jsx is an included artifact example. You can move the file to src/components/LLMModel.jsx.

Then add it to your app by updating App.jsx:

import './App.css'
import LLMModel from './components/LLMModel'

function App() {
  return (
    <>
      <LLMModel/>
    </>
  )
}

export default App

5. Run the App

npm run dev

Example App Online Example App with LLMModel.jsx Online

claude-react-jumpstart's People

Contributors

bklieger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.