https://github.com/sohanemon/diagnostic-center-client
https://github.com/sohanemon/diagnostic-center-client
practice swiper
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sohanemon/diagnostic-center-client
- Owner: sohanemon
- Created: 2022-11-13T13:29:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-13T13:35:25.000Z (over 3 years ago)
- Last Synced: 2025-03-05T01:42:12.559Z (over 1 year ago)
- Topics: practice, swiper
- Language: JavaScript
- Homepage: https://shapla-diagnostic-center.web.app/
- Size: 341 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Get data from Form
```js
const data = ["name", "photoURL", "email", "password"].map(
(el) => e.target[el].value
); //['sfj','sfa','sfa','dfa']
```
or a better way
```js
let data = {}; // its important
["email", "password"].forEach((el) => (data[el] = e.target[el].value)); // {email: 'efj', password: 'sse'}
```
## To align something with margin (mx-auto, ml-auto, mr-auto)
- set them as block element
```js
```
## Promise based toast/react-hot-toast
- syntax
```js
toast.promise(promise, {
/*configs*/
});
```
- example
```js
const promise = client.post("/service", data);
toast.promise(promise, {
loading: "loading",
success: "added successfully",
error: "something went wrong",
});
```
- and also further `.then` can be added
```js
toast
.promise(client.post("/service", data), {
// ...
})
.then(() => {
e.target.reset();
navigate("/");
});
```