@flywire/react-hooks
Advanced tools
Comparing version 0.0.5 to 0.0.6-0
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: 'current', | ||
}, | ||
modules: 'commonjs', | ||
}, | ||
], | ||
'@babel/preset-react', | ||
], | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
}; |
{ | ||
"name": "@flywire/react-hooks", | ||
"version": "0.0.5", | ||
"version": "0.0.6-0", | ||
"description": "A collection of Reacts hooks used in Flywire", | ||
@@ -48,3 +48,3 @@ "main": "src/index.js", | ||
}, | ||
"peerDependencies": { | ||
"dependencies": { | ||
"react": "^16.13.1", | ||
@@ -51,0 +51,0 @@ "react-dom": "^16.13.1" |
@@ -29,9 +29,24 @@ # useForm | ||
import React from 'react'; | ||
import { useToggle } from '@flywire/react-hooks'; | ||
import { useForm } from '@flywire/react-hooks'; | ||
function App() { | ||
const [on, toggle] = useToggle(); | ||
const { values, handleChange, dirtyValues } = useForm(); | ||
return <button onClick={toggle}>{on ? 'ON' : 'OFF'}</button>; | ||
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> | ||
); | ||
} | ||
``` |
@@ -24,1 +24,14 @@ # useToggle | ||
| Function to update the state | | ||
#### Usage | ||
```jsx harmony | ||
import React from 'react'; | ||
import { useToggle } from '@flywire/react-hooks'; | ||
function App() { | ||
const [on, toggle] = useToggle(); | ||
return <button onClick={toggle}>{on ? 'ON' : 'OFF'}</button>; | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18879
386
+ Addedreact@^16.13.1
+ Addedreact-dom@^16.13.1