Ⅰ. 插件描述
vim snippets for Facebook's React library.
Ⅱ. 基本信息
| 创建日期: 2017-08-09 |
| 使用用户: 3 |
| Github星: 0 |
| 插件作者: VimSnippets |
|
|
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:
Plugin 'vimsnippets/vim-react-snippets-are-made-of'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:
NeoBundle 'vimsnippets/vim-react-snippets-are-made-of'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:
Plug 'vimsnippets/vim-react-snippets-are-made-of'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vimsnippets/vim-react-snippets
Ⅳ. 文档说明
# vim-react-snippets
vim snippets for Facebook's React library.

Snippets
Skeleton
| Trigger | Content |
|---|
ir→ | import React |
irc→ | import React & Component |
ird→ | import React DOM |
irp→ | import React PropTypes |
rsc→ | React Stateless Component |
rcc→ | React Class Component |
Lifecycle
| Trigger | Content |
|---|
cwm→ | componentWillMount() |
cdm→ | componentDidMount() |
cwp→ | componentWillReceiveProps(nextProps) |
scu→ | shouldComponentUpdate(nextProps, nextState) |
cwu→ | componentWillUpdate(nextProps, nextState) |
cdu→ | componentDidUpdate(prevProps, prevState) |
cwum→ | componentWillUnmount() |
ren→ | render() |
rren→ | ReactDOM.render() |
fdn→ | React.findDOMNode() |
PropTypes
| Trigger | Content |
|---|
pt→ | propTypes |
pt.a→ | PropTypes.array |
pt.b→ | PropTypes.bool |
pt.f→ | PropTypes.func |
pt.n→ | PropTypes.number |
pt.o→ | PropTypes.object |
pt.s→ | PropTypes.string |
pt.sb→ | PropTypes.symbol |
pt.no→ | PropTypes.node |
pt.e→ | PropTypes.element |
pt.if→ | PropTypes.instanceOf |
pt.of→ | PropTypes.oneOf |
pt.oft→ | PropTypes.oneOfType (Union) |
pt.af→ | PropTypes.arrayOf (Instances) |
pt.oo→ | PropTypes.objectOf |
pt.sp→ | PropTypes.shape |
.ir→ | isRequired |
Others
| Trigger | Content |
|---|
props→ | this.props |
state→ | this.state |
refs→ | this.refs |
set→ | this.setState(...) |
dp→ | defaultProps |