Git Product home page Git Product logo

react-starter's Introduction

Getting Started with React in vscode dev containers

Table of Contents

Overview

This project was bootstrapped with Create React App.

Starting off in local environment

In the project directory, you can run:

npm install

Installs all dependencies needed to run the app

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

Starting off in vscode dev container

You can get started with react using vscode dev container. Make sure you have these pre-requisities installed

Prerequisites

  • Make sure you have docker running. For windows you can install Docker Desktop manually. Alternatively you can also run below powershell script to install wsl2 and docker desktop
## Install wsl
wsl --install

# Set WSL 2 as default version
wsl --set-default-version 2

# Install a specific Linux distribution (e.g., Ubuntu)
wsl --install -d Ubuntu

## Download docker desktop
Invoke-WebRequest -Uri https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe -OutFile DockerDesktopInstaller.exe

# Install Docker Desktop
Start-Process -Wait -FilePath .\DockerDesktopInstaller.exe -ArgumentList 'install', '--accept-license', '--always-run-service'

# Clean up the installer file
Remove-Item .\DockerDesktopInstaller.exe

# System restarts, after that do these

# Verify Docker installation
docker --version

# Run a test Docker container
docker run hello-world
  • Make sure you have vscode installed and extension Dev Containers extension Alternatively you can also run below powershell script to setup these
## Install chocolatey and apps

try {
    choco config get cacheLocation
}
catch {
    Write-Output "Chocolatey not detected, trying to install now"
    Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}

$chocolateyAppList = 'git.install|2.41.0,vscode|1.91.1,materialicon-vscode|4.28.0'

$appsToInstall = $chocolateyAppList -split "," | foreach { "$($_.Trim())" }

foreach ($app in $appsToInstall) {

    $name = $app.Split("|")[0]
    $version = $app.Split("|")[1]
    $params = $app.Split("|")[2]
    
    Write-Host "Installing: $name | $version with extra params: [$params]"

    if ($null -eq $params) {
        Write-Host "choco install $name --version $version  /y -Force | Write-Output"
        & choco install $name --version $version  /y -Force | Write-Output
    }
    else {
        Write-Host "Installing: $name | $version"
        & choco install $name --version $version  --params $params /y -Force | Write-Output
    }
}

Start-Process "C:\Program Files\Microsoft VS Code\bin\code.cmd" -ArgumentList "--install-extension","ms-vscode-remote.remote-containers","--force" -wait

Run app inside dev container

  • Git clone this repo
  • Go to the repo root and open project in vscode.
  • Once you have Dev Containers extension installed and docker running, vscode will prompt you to open the folder in container. You have two options:
    • Reopen in dev container: Files stay where they are and you work on them directly from the linked docker volume.
    • Clone in volume: Preferred for windows users with wsl2. It clones a copy of the project into a docker container and volume. This options is faster on windows.

dev-container

Other commands

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

react-starter's People

Contributors

alfurquan avatar

Watchers

 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.