react-confirm-lite 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,29 @@ or
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
|
+
## Complete Example
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
'use client' //If you are using nextjs then add this line
|
|
72
|
+
import { confirm, ConfirmContainer } from 'react-confirm-lite'
|
|
73
|
+
|
|
74
|
+
export default function Page() {
|
|
75
|
+
const handleDelete = async () => {
|
|
76
|
+
const isConfirmed = await confirm('Are you sure you want to delete?')
|
|
77
|
+
if (isConfirmed) {
|
|
78
|
+
// Perform deletion
|
|
79
|
+
console.log('Item deleted')
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div>
|
|
85
|
+
<button onClick={handleDelete}>Delete Item</button>
|
|
86
|
+
<ConfirmContainer />
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
```
|
|
68
91
|
## How to customize
|
|
69
92
|
You can customize it by giving classes like this
|
|
70
93
|
```jsx
|
|
@@ -126,30 +149,6 @@ yarn add react-confirm-lite
|
|
|
126
149
|
pnpm add react-confirm-lite
|
|
127
150
|
```
|
|
128
151
|
|
|
129
|
-
## Complete Example
|
|
130
|
-
|
|
131
|
-
```tsx
|
|
132
|
-
'use client'
|
|
133
|
-
import { confirm, ConfirmContainer } from 'react-confirm-lite'
|
|
134
|
-
|
|
135
|
-
export default function Page() {
|
|
136
|
-
const handleDelete = async () => {
|
|
137
|
-
const isConfirmed = await confirm('Are you sure you want to delete?')
|
|
138
|
-
if (isConfirmed) {
|
|
139
|
-
// Perform deletion
|
|
140
|
-
console.log('Item deleted')
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<div>
|
|
146
|
-
<button onClick={handleDelete}>Delete Item</button>
|
|
147
|
-
<ConfirmContainer />
|
|
148
|
-
</div>
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
152
|
## Props
|
|
154
153
|
|
|
155
154
|
### ConfirmContainer
|
package/package.json
CHANGED