kanca v1.4.8
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 kancaby using yarn:
$ yarn add kancakanca 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-cmdTherefore just create files in root-dir which named
.env.developmentand.env.production
and modify as listed below.
.env.development
REACT_APP_API=http://localhost:8080.env.production
REACT_APP_API=https://api.myawesomewebservice.comAfter 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
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago