kanca v1.4.2
Kanca is custom React Hooks
library.
☕️ Features
- Small and lightweight
- Easy to learn
- Functional approach
- Fully written in Typescript
🕺 Install
by using npm
:
$ npm i kanca
by using yarn
:
$ yarn add kanca
kanca uses env-cmd as peerDependency. Make sure to install it if you want to environment variables in http hooks like useFetch
.
If you don't know how to install it, just follow below section
yarn add env-cmd
Therefore just create files in root-dir which named
.env.development
and.env.production
and modify as listed below.
.env.development
REACT_APP_API=http://localhost:8080
.env.production
REACT_APP_API=https://api.myawesomewebservice.com
After creating files make sure to hide
those files in .gitignore. They might include our credentials etc.
You could set various environment variables that needs in your application in those files like .env.development or .env.production.
Then: modify your package.json'scripts' like listed below
"scripts": {
"start": "env-cmd -f ./.env.development react-scripts start",
"build": "env-cmd -f ./.env.production react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
If you're ok until here, we can continue
You could import kanca in two ways
- kanca
- kanca/subpackage-name
What do I mean?
kanca has several subpackages. For example:
- http
- form
- util ( not implemented yet )
That's exactly why both imports are valid.
import { useFetch } from "kanca";
or
import { useFetch } from "kanca/http";
Before using any hook, you should read its documentation!
🎨 Hooks
Made with
License
MIT © enesusta
6 days ago
7 days ago
7 days ago
2 months ago
2 months ago
10 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago