TAGS

react-box

CREATED

UPDATED

STARS

INSTALL

...

REPOSITORY
GitHub Download
Please wait: Fetching readme...

b"# React Truffle Box\n\nThis 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.\n\n## Installation\n\nFirst ensure you are in a new and empty directory.\n\n1. Run the `unbox` command via `npx` and skip to step 3. This will install all necessary dependencies. A Create-React-App is generated in the `client` directory.\n ```js\n npx truffle unbox react\n ```\n\n2. Alternatively, you can install Truffle globally and run the `unbox` command.\n ```javascript\n npm install -g truffle\n truffle unbox react\n ```\n\n3. Run the development console.\n ```javascript\n truffle develop\n ```\n\n4. Compile and migrate the smart contracts. Note inside the development console we don't preface commands with `truffle`.\n ```javascript\n compile\n migrate\n ```\n\n5. In the `client` directory, we run the React app. Smart contract changes must be manually recompiled and migrated.\n ```javascript\n // in another terminal (i.e. not in the truffle develop prompt)\n cd client\n npm run start\n ```\n\n6. 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.\n ```javascript\n // inside the development console.\n test\n\n // outside the development console..\n truffle test\n ```\n\n7. Jest is included for testing React components. Compile your contracts before running Jest, or you may receive some file not found errors.\n ```javascript\n // ensure you are inside the client directory when running this\n npm run test\n ```\n\n8. To build the application for production, use the build script. A production build will be in the `client/build` folder.\n ```javascript\n // ensure you are inside the client directory when running this\n npm run build\n ```\n\n## FAQ\n\n* __How do I use this with the Ganache-CLI?__\n\n It's as easy as modifying the config file! [Check out our documentation on adding network configurations](http://truffleframework.com/docs/advanced/configuration#networks). Depending on the port you're using, you'll also need to update line 29 of `client/src/utils/getWeb3.js`.\n\n* __Where is my production build?__\n\n The production build will be in the `client/build` folder after running `npm run build` in the `client` folder.\n\n* __Where can I find more documentation?__\n\n This box is a marriage of [Truffle](http://truffleframework.com/) and a React setup created with [create-react-app](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md). Either one would be a great place to start!\n"