Socket
Socket
Sign inDemoInstall

react-confirm

Package Overview
Dependencies
5
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0-2 to 0.3.0-3

typescript/index.d.ts

23

package.json
{
"name": "react-confirm",
"version": "0.3.0-2",
"version": "0.3.0-3",
"description": "Small library which makes your Dialog component callable",

@@ -21,3 +21,4 @@ "main": "lib/index.js",

"lib",
"src"
"src",
"typescript"
],

@@ -28,3 +29,3 @@ "scripts": {

"prepublish": "npm run clean && npm run build",
"test": "echo succeeded"
"test": "jest"
},

@@ -34,4 +35,4 @@ "author": "",

"peerDependencies": {
"react-dom": "18.x",
"react": "18.x"
"react": "18.x",
"react-dom": "18.x"
},

@@ -43,5 +44,15 @@ "devDependencies": {

"@babel/preset-react": "^7.16.7",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"babel-core": "^6.26.3",
"babel-jest": "^29.5.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"regenerator-runtime": "^0.13.11",
"rimraf": "^3.0.2"
},
"dependencies": {}
"dependencies": {},
"typings": "typescript/index.d.ts"
}

@@ -82,3 +82,3 @@ # react-confirm

Now, you can show dialog just like window.confirm with async-await. The most common example is onclick handler for submit buttons.
```js

@@ -112,3 +112,3 @@ import { confirmWrapper, confirm } from './confirm'

Create your own `createConfirmation` using `createConfirmationCreater` and `createReactTreeMounter`.
Create your own `createConfirmation` function and `MountPoint` Component using `createConfirmationCreater` and `createReactTreeMounter`.

@@ -118,3 +118,3 @@ ```js

const mounter = createReactTreeMounter();
const mounter = createReactTreeMounter();

@@ -145,3 +145,3 @@ export const createConfirmation = createConfirmationCreater(mounter);

```js
const mounter = createReactTreeMounter(document.body);
const mounter = createReactTreeMounter(document.body);
```

@@ -152,8 +152,10 @@

## typescript
## typescript usage
Below, we present two possible ways to define a confirmation dialog component using react-confirm. You can choose either based on your preference.
Experimentally added full typescript declaration files at `typescript` branch.
```ts
const Confirmation1: React.FC<ConfirmDialogProps<Props, Response>> = (props) => (<Dialog></Dialog>)
const Confirmation2: ConfirmDialog<Props, Response> = (props) => (<Dialog></Dialog>)
```
see [typescript example](https://github.com/haradakunihiko/react-confirm/tree/typescript/example/ts-react-bootstrap).
and try `npm install git@github.com:haradakunihiko/react-confirm.git#typescript` to use in your project.
Ensure to specify both the dialog component's `Props` and the response value `Response` when using these types. These typings will be especially useful when defining functions to display the dialog.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc