Skip to content

Instantly share code, notes, and snippets.

@lesagi
Last active October 17, 2020 15:52
Show Gist options
  • Save lesagi/7f7fbf9f3aa349be39ca6a2529095ac4 to your computer and use it in GitHub Desktop.
Save lesagi/7f7fbf9f3aa349be39ca6a2529095ac4 to your computer and use it in GitHub Desktop.
This script is used to automatically create react component under "<root_project>/src/components"
#!/usr/bin/bash
# CRC stands for "Create React Component"
# To use, just run CRC.sh <project_root_folder> <component_name>
# The script will automatically create the component in the following
# PATH : <root>/src/components/<component_name>/<component_name>.jsx
# with a basic skeleton in it
mkdir -p ${1}/src/components/${2} && touch ${1}/src/components/${2}/${2}.jsx
cat <<EOT >>./src/components/${2}/${2}.jsx
import React from 'react';
const ${2} = () => {
}
export default ${2};
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment