Vim UltiSnips snippets for React using modern ES6 syntax
You must follow the convention: MyComponent
's source file is MyComponent.js
and the test for it is MyComponent.spec.js
or MyComponent.test.js
in the same directory. This allows to generate variables and classes
Snippets for react components
rc
- boilerplate for React Componentrcf
- boilerplate for React Component as pure Functionrfdn
- React.findDOMNode- rpt... - PropTypes records
rptr
- PropTypes.[$1].isRequiredrptar
- PropTypes.array.isRequiredrptbr
- PropTypes.bool.isRequiredrptfr
- PropTypes.func.isRequiredrptnr
- PropTypes.nnumber.isRequiredrptor
- PropTypes.object.isRequiredrptsr
- PropTypes.string.isRequiredrpter
- PropTypes.element.isRequired
Other types will be (or won't be) implemented soon. Pull requests are welcome
Snippets for react tests.
rtc
- creates test boilerplate for Componentrtr
- TestUtils.renderIntoDocumentrtfrdct
- TestUtils.findRenderedDOMComponentWithTagrtfrdcc
- TestUtils.findRenderedDOMComponentWithClassrtfrct
- TestUtils.findRenderedComponentWithTypertsrdct
- TestUtils.scryRenderedDOMComponentsWithTagrtsrdcc
- TestUtils.scryRenderedDOMComponentsWithClassrtsrct
- TestUtils.scryRenderedComponentsWithType
Using Vundle:
" install UltiSnips
Plugin 'SirVer/ultisnips'
"let g:UltiSnipsExpandTrigger="<C-J>" "(optional) CTRL-J instead of TAB to avoid conflicts with YCM
Plugin 'alexbyk/vim-ultisnips-react'