Install React Drops
npm i -g react-drops
1. drops
drops User
//generates basic template for a User component
- component:
./app/components/User.js
- styles:
./app/styles/User.css
import React from 'react';
const User = React.createClass({
render() {
return (
<div className="app">
<h1>Main Component</h1>
</div>
);
}
});
export default User;
import React from 'react';
class User extends React.Component {
render() {
return (
<div className="app">
<h1>Main Component</h1>
</div>
)
}
}
export default User;
import(./styles/User.scss);
import React from 'react';
const User = (props) => {
return (
<div className="user">
<h1>{props.user}</h1>
</div>
)
}
export default User;
.user {
color: red;
}
TODO
- Add Component name as Argument w/flags
- Add Commands + arguments
FUTURE COMMANDS or FLAGS?
drops [component Name] --props name:string age:number availability:boolean
Creates component with parameters (props w/ validation)
inject [Component] [destination file]
Calls component in another file (dest file)
clean [Component]
Prompt?
Removes Component Files (js & scss)