Home

Awesome

React Truffle Box

This box comes with everything you need to start using smart contracts from a react app. This is as barebones as it gets, so nothing stands in your way.

Installation

  1. Install Truffle globally.
    npm install -g truffle
    

2. Download the box. This also takes care of installing the necessary dependencies. javascript truffle unbox react

  1. Clone this repository (using this fork of react-box you do...)

    git clone https://github.com/digitaldonkey/react-box-event-handling.git
    cd react-box-event-handling
    
  2. Run the development console.

    truffle develop
    
  3. Compile and migrate the smart contracts. Note inside the development console we don't preface commands with truffle.

    compile
    migrate
    
  4. Run the webpack server for front-end hot reloading (outside the development console). Smart contract changes must be manually recompiled and migrated.

    // Serves the front-end on http://localhost:3000
    npm run start
    
  5. Truffle can run tests written in Solidity or JavaScript against your smart contracts. Note the command varies slightly if you're in or outside of the development console.

    // If inside the development console.
    test
    
    // If outside the development console..
    truffle test
    
  6. Jest is included for testing React components. Compile your contracts before running Jest, or you may receive some file not found errors.

    // Run Jest outside of the development console for front-end component tests.
    npm run test
    
  7. To build the application for production, use the build command. A production build will be in the build_webpack folder.

    npm run build
    

FAQ