Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flywire/react-hooks

Package Overview
Dependencies
Maintainers
6
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flywire/react-hooks - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

src/useToggle/index.js

10

CHANGELOG.md

@@ -11,2 +11,12 @@ # Changelog

## [0.0.5] - 2020-06-12
### Changed
- Add example using useToggle
### Fixed
- Export useToggle
## [0.0.4] - 2020-06-12

@@ -13,0 +23,0 @@

2

package.json
{
"name": "@flywire/react-hooks",
"version": "0.0.4",
"version": "0.0.5",
"description": "A collection of Reacts hooks used in Flywire",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -13,39 +13,25 @@ # useForm

| Key | Description |
| :-------------------- | :------------------------------------------------ |
| `defaultValues` | Initial values of the fields. Default = {} |
| Key | Description |
| :-------------- | :----------------------------------------- |
| `defaultValues` | Initial values of the fields. Default = {} |
#### Return object
| Key | Description |
| :-------------------- | :------------------------------------------------ |
| `values` | Field values |
| `dirtyFields` | Fields modified by the user |
| `handleChange` | Callback for persisting the field's value |
| Key | Description |
| :------------- | :---------------------------------------- |
| `values` | Field values |
| `dirtyFields` | Fields modified by the user |
| `handleChange` | Callback for persisting the field's value |
#### Usage
#### Usage
```jsx harmony
import React from 'react';
import { useForm } from '@flywire/react-hooks';
import { useToggle } from '@flywire/react-hooks';
function App() {
const { values, handleChange, dirtyValues } = useForm();
const [on, toggle] = useToggle();
function handleSubmit(evt) {
evt.preventDefault();
}
function handleInputChange(evt) {
handleChange(evt.target.name, evt.target.value);
}
return (
<form onSubmit={handleSubmit}>
<input name="firstname" onChange={handleInputChange} />
{!values.firstName && dirtyValues.firstName && 'First name is required.'}
<input type="submit" />
</form>
);
return <button onClick={toggle}>{on ? 'ON' : 'OFF'}</button>;
}
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc