Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !2685

Add Generating new Component section to User Guide

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/diegohaz/patch-1 into master Jun 29, 2017
  • Overview 2
  • Commits 2
  • Pipelines 0
  • Changes 2

Created by: diegohaz

Related to #2482 (closed), #1242 (closed) and #1886

Generating new Component

Instead of creating component files by hand, you can use generact to generate new components based on existing ones.

Showing generact usage

Optionally, you can add it to devDependencies (yarn add --dev generact) and add an npm script to easily generate new components based on another specific one (e.g. src/components/MySimpleBaseComponent/MySimpleBaseComponent.js):

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
+   "component": "generact src/components/MySimpleBaseComponent/MySimpleBaseComponent.js"
  }

Then, just run yarn component.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/diegohaz/patch-1