[NPM + React] Prepare a Custom React Hook to be Published as an npm Package
Before we publish our package, we want to make sure everything is set up correctly. We’ll cover versioning, preparing our package, adding a proper README, and updating our package.json
.
Using npm version:
The reason to use npm version to prumping the version, is because it create a version commit and tag.
npm version patch
Setup a pre- and post- scripts:
"prepare": "yarn run build",
"postpublilsh": "git push --tags"
peerDependenices:
You might also need to update peerDependencies in order to info the user which verison of react is minimue required.
"peerDependencies": {
"react": ">=16.8.6"
}
publishConfig:
Depend on your package name:
// A
"name": "some-react-hooks" //B
"name": "@zhentiw/some-react-hooks" //@<user-name>/package-name
If you are using B version, it default to a private npm package, if you want to make it public:
"publishConfig": {
"access": "public"
}
[NPM + React] Prepare a Custom React Hook to be Published as an npm Package的更多相关文章
- [React] Write a Custom React Effect Hook
Similar to writing a custom State Hook, we’ll write our own Effect Hook called useStarWarsQuote, whi ...
- [React] Write a Custom State Hook in React
Writing your own custom State Hook is not as a daunting as you think. To keep things simple, we'll r ...
- 【React 资料备份】React Hook
Hooks是React16.8一个新增项,是我们可以不用创建class组件就能使用状态和其他React特性 准备工作 升级react.react-dom npm i react react-dom - ...
- [React] Reduce Code Redundancy with Custom React Hooks
In this lesson, we'll cover how to create a custom React hook for managing the state of any input. T ...
- React报错之React Hook 'useEffect' is called in function
正文从这开始~ 总览 为了解决错误"React Hook 'useEffect' is called in function that is neither a React function ...
- React报错之React hook 'useState' cannot be called in a class component
正文从这开始~ 总览 当我们尝试在类组件中使用useState 钩子时,会产生"React hook 'useState' cannot be called in a class compo ...
- [React] Validate Custom React Component Props with PropTypes
In this lesson we'll learn about how you can use the prop-types module to validate a custom React co ...
- React报错之React Hook useEffect has a missing dependency
正文从这开始~ 总览 当useEffect钩子使用了一个我们没有包含在其依赖数组中的变量或函数时,会产生"React Hook useEffect has a missing depende ...
- React报错之React hook 'useState' is called conditionally
正文从这开始~ 总览 当我们有条件地使用useState钩子时,或者在一个可能有返回值的条件之后,会产生"React hook 'useState' is called conditiona ...
随机推荐
- springcloud使用之断路器hystrix
上一篇文章提到我们最近开了个新项目,目的是将新的业务放到新项目中,老项目单独维护,再逐步迁移老项目到新项目里.但就在前端时间生产环境发生了一个事故,事故开始的异常是我们的业务发现前端h5页面办理很慢, ...
- Docker之数据卷(Data Volumes)操作
目的: 前言 Docker宿主机和容器之间文件拷贝 数据卷 数据卷容器 前言 Docker 数据管理 在生产环境中使用 Docker ,往往需要对数据进行持久化,或者需要在多个容器之间进行 数据共享, ...
- 论文笔记 : NCF( Neural Collaborative Filtering)
ABSTRACT 主要点为用MLP来替换传统CF算法中的内积操作来表示用户和物品之间的交互关系. INTRODUCTION NeuCF设计了一个基于神经网络结构的CF模型.文章使用的数据为隐式数据,想 ...
- 阿里巴巴 Java 开发手册 (五) 集合处理
1. [强制]关于 hashCode 和 equals 的处理,遵循如下规则: 1) 只要重写 equals,就必须重写 hashCode. 2) 因为 Set 存储的是不重复的对象,依据 hashC ...
- docker容器的使用整理
2019/10/24, docker 19.03.4 摘要:docker容器常用命令整理 gitbooks文档 docker脚本安装 使用官方脚本安装docker,从阿里云下载: curl -fsSL ...
- 网络编程之 tcp服务器(一)
1.创建套接字 2.bind绑定ip和port 作为服务方,ip port 应该是固定的,所以要绑定;客户端一般不绑定 3.listen使套接字变成监听套接字,即变为被动链接 4.accept等待客户 ...
- Android数据库GreenDao配置版本问题
感谢该贴解决我多天的困惑:https://blog.csdn.net/u013472738/article/details/72895747 主要是降低了GreenDao版本 网上很多教程说的版本都是 ...
- scrapy文件管道
安装scrapy pip install scrapy 新建项目 (python36) E:\www>scrapy startproject fileDownload New Scrapy pr ...
- python系列:二、Urllib库的高级用法
1.设置Headers 有些网站不会同意程序直接用上面的方式进行访问,如果识别有问题,那么站点根本不会响应,所以为了完全模拟浏览器的工作,我们需要设置一些Headers 的属性. 打开我们的浏览器,调 ...
- java requestmapping中关于路径的问题
需要这种url写的方式才能映射