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

@brightleaf/react-hooks

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightleaf/react-hooks - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

lib/use-form.js

8

lib/index.js

@@ -54,2 +54,8 @@ "use strict";

});
Object.defineProperty(exports, "useForm", {
enumerable: true,
get: function () {
return _useForm.default;
}
});
Object.defineProperty(exports, "useGet", {

@@ -180,2 +186,4 @@ enumerable: true,

var _useForm = _interopRequireDefault(require("./use-form"));
var _useGet = _interopRequireDefault(require("./use-get"));

@@ -182,0 +190,0 @@

2

package.json
{
"name": "@brightleaf/react-hooks",
"version": "5.0.0",
"version": "5.1.0",
"description": "Useful react hooks",

@@ -5,0 +5,0 @@ "files": [

@@ -7,2 +7,3 @@ # Brightleaf React Hooks

* [`useFetch`](#fetch-hook) - Hook to use Fetch
* [`useForm`](#form-hook) - Hook to make using forms super easy
* [`useGet`](#get-hook) - Hook to make a get request

@@ -86,2 +87,70 @@ * [`usePost`](#post-hook) - Hook to make an HTTP Post

## Form Hook
```javascript
import React, { useState } from 'react'
import { useForm } from '@brightleaf/react-hooks'
export default () => {
const { addToForm, onSubmit } = useFetch()
return (
<form
onSubmit={onSubmit(data => {
console.info('onsubmit handler', data)
})}
>
<fieldset>
<legend>Form Hook</legend>
<input
name="firstName"
type="text"
ref={addToForm}
defaultValue="Brightleaf"
/>
<input
name="lastName"
type="text"
ref={addToForm}
defaultValue="Hooks"
/>
<br />
<select ref={addToForm} name="dropdown" defaultValue="13">
<optgroup label="First Group">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option>
</optgroup>
<optgroup label="Second Group">
<option value="11">Second First</option>
<option value="12">Second Second</option>
<option value="13">Second Third</option>
</optgroup>
</select>
<br />
<input type="checkbox" name="check" defaultChecked ref={addToForm} />
<br />
<div>
<label>The Radio</label>
<div>
<label> First </label>
<input name="rgroup" type="radio" value="first" ref={addToForm} />
</div>
<div>
<label> Second </label>
<input
name="rgroup"
type="radio"
value="second"
ref={addToForm}
/>
</div>
</div>
<br />
<button type="submit">Submit</button>
</fieldset>
</form>
)
}
```
## GraphQL Hook

@@ -88,0 +157,0 @@

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