useFeathers
⚓️ React Hooks + FeathersJS = useFeathers. Increase productivity in building small and medium applications. 🚀
Hooks
- useFeathers
- useFind
- useGet
- useCreate
- usePatch
- useUpdate
- useRemove
- useRealtime
- useAuthenticate
- useLogout
- useAuthenticationEvents
Additional features
- Paginate
- Realtime
- Realtime deep populate
- Custom filter realtime
- Cache
Install
Use yarn
yarn add usefeathers
or use npm
npm i usefeathers --save
Demo
Example
useFeathers
Set instante feathers client for initilalization hooks.
;;;;; const URL = 'http://localhost:3030'; const socket = ;const feathers = ; ;
useFind
; const users loading error = ;// ORconst fetchUsers users loading error = ;const response = await ; // return Promise;// ORconst options = paginate: true ; // optionalconst data loading error fetchMore = ;// ORconst options = paginate: true ; // optionalconst fetchUsers users loading error fetchMore = ;
const options = paginate: true || false realtime: true || false // watch events created, patched, updated, removed, and automatically make the changes ;
useGet
; const options = realtime: true ; // optionalconst user loading error = ;// ORconst getUser user loading error = ;const response = await ; // return Promise
const options = realtime: true || false;
useCreate
; const user loading error = ;// ORconst createUser user loading error = ;const response = await ; // return Promise // query optional
usePatch
; const user loading error = ;// ORconst patchUser user loading error = ;const response = await ; // return Promise // query optional
useUpdate
; const user loading error = ;// ORconst updateUser user loading error = ;const response = await ; // return Promise // query optional
useRemove
; const user loading error = ;// ORconst removeUser user loading error = ;const response = await ; // return Promise // query optional
useRealtime
; // events "created", "patched", "updated", "removed" const userCreated = ;// ORconst userCreated = ;
useAuthenticate / useLogout / useAuthenticationEvents
; const authenticate dataAuth authenticated loading error = ;const logout = ;const response = ; // events "authenticated", "logout", "reauthentication-error"