- Make new repo for your component and clone it
$ git clone https://github.com/opuscapita/react-your-component-name-here
- Clone this repository
$ cd .. $ git clone https://github.com/opuscapita/react-component-template
- Copy template files recursively to your empty component directory
$ cp -R * ../react-your-component-name-here $ cp .* ../react-your-component-name-here
- Update package.json
- Replace all occurences of
react-component-template
andReact component template
with your component name
- Put your component code under
src
and demo code undersrc_docs\component
- Develop component and demo with run
npm run hot
-> http://localhost:5555 - Update README.md
- Remove
Creating new component from template
section - Replace all occurences of
react-component-template
withreact-your-component-name
- Update Description, API and Code example
- Build the component and demo
npm run build
- Push initial commit to master branch
- Enable demo from github repository settings -> HitHub Pages -> Source =
Master branch /docs folder
Describe the component here
npm install @opuscapita/react-component-template
View the DEMO
View the Change log
View the Migrate guide between major versions
The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.
You need to configure your module loader to use cjs
or es
fields of the package.json to use these module types.
Also you need to configure sass loader, since all the styles are in sass format.
- With webpack use resolve.mainFields to configure the module type.
- Add SASS loader to support importing of SASS styles.
Prop name | Type | Default | Description |
---|---|---|---|
propName | string | Describe the prop here |
import React from 'react';
import { Example } from '@opuscapita/react-component-example';
export default class ReactView extends React.Component {
render() {
return (
<Example
propName="propValue"
/>
);
}
}