![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-form
Advanced tools
React Form is a lightweight framework and utility for building powerful forms in React applications.
Simple, powerful, highly composable forms in React
Sign up for the React-Tools Slack Org!
npm install --save react-form
import { Form, Text, Radio, TextArea, Checkbox } from 'react-form';
const ExampleForm = () => (
<Form render={({
submitForm
}) => (
<form onSubmit={submitForm}>
<Text field="firstName" placeholder='First Name' />
<Text field="lastName" placeholder='Last Name' />
<div>
<label>
Male <Radio field='gender' value="male" />
</label>
<label>
Female <Radio field='gender' value="female" />
</label>
</div>
<TextArea field="bio" />
<Checkbox field="agreesToTerms" />
<button type="submit">Submit</button>
</form>
)} />
)
import { Form, Text } from 'react-form';
const ExampleForm = () => (
<Form render={({
submitForm,
values,
addValue,
removeValue
}) => (
<form onSubmit={submitForm}>
<Text field="firstName" placeholder='First Name' />
<Text field="lastName" placeholder='Last Name' />
<div>
Friends
{values.friends && values.friends.map((friend, i) => (
// Loop over the friend values and create fields for each friend
<div>
<Text field={['friends', i, 'firstName']} placeholder='First Name' />
<Text field={['friends', i, 'lastName']} placeholder='Last Name' />
// Use the form api to add or remove values to the friends array
<button onClick={() => removeValue('friends', i)>
Remove Friend
</div>
</div>
))}
// Use the form api to add or remove values to the friends array
<button onClick={() => addValue('friends', {})>
Add Friend
</button>
</div>
<button type="submit">Submit</button>
</form>
)} />
)
import { Form, FormApi, NestedField, Text } from 'react-form';
// Reuse The user fields for the user and their friends!
const UserFields = () => (
<div>
<Text field="firstName" placeholder='First Name' />
<Text field="lastName" placeholder='Last Name' />
</div>
)
const ExampleForm = () => (
<Form render={({
submitForm,
values,
addValue,
removeValue
}) => (
<form onSubmit={submitForm}>
<UserFields />
<NestedField field='friends' render={() => ( // Create a new nested field context
<div>
Friends
{values.friends.map((friend, i) => (
<div>
<NestedField field={['friends', i]} render={() => (
<UserFields /> // Now the user fields will map to each friend!
)} />
<button onClick={() => removeValue('friends', i)>
Remove Friend
</div>
</div>
))}
<button onClick={() => addValue('friends', {})>
Add Friend
</button>
</div>
)}/>
<button type="submit">Submit</button>
</form>
)} />
)
Visit react-form.js.org for examples and documentation for 2.x.x of React-Form.
Older versions:
FAQs
⚛️ 💼 React hooks for managing form state and lifecycle
The npm package react-form receives a total of 6,751 weekly downloads. As such, react-form popularity was classified as popular.
We found that react-form demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.