Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@hookform/devtools
Advanced tools
@hookform/devtools is a development tool for React Hook Form, which provides a visual interface to debug and inspect forms created with React Hook Form. It helps developers to see the form state, errors, and other useful information in real-time.
Visual Form State Inspection
This feature allows developers to visually inspect the form state, including values, errors, and touched fields. The DevTool component is integrated into the form and provides a real-time view of the form's state.
import { DevTool } from '@hookform/devtools';
import { useForm } from 'react-hook-form';
function MyForm() {
const { control, handleSubmit } = useForm();
const onSubmit = data => console.log(data);
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input name="firstName" ref={control.register} />
<input name="lastName" ref={control.register} />
<button type="submit">Submit</button>
<DevTool control={control} />
</form>
);
}
Error Debugging
This feature helps in debugging form errors by providing a visual representation of the errors in the form. The DevTool component shows the errors in real-time, making it easier to identify and fix issues.
import { DevTool } from '@hookform/devtools';
import { useForm } from 'react-hook-form';
function MyForm() {
const { control, handleSubmit, errors } = useForm();
const onSubmit = data => console.log(data);
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input name="firstName" ref={control.register({ required: true })} />
{errors.firstName && <span>This field is required</span>}
<input name="lastName" ref={control.register({ required: true })} />
{errors.lastName && <span>This field is required</span>}
<button type="submit">Submit</button>
<DevTool control={control} />
</form>
);
}
Real-time Form Updates
This feature allows developers to see real-time updates of the form state as users interact with the form. The DevTool component provides a live view of the form's state, making it easier to track changes and debug issues.
import { DevTool } from '@hookform/devtools';
import { useForm } from 'react-hook-form';
function MyForm() {
const { control, handleSubmit, watch } = useForm();
const onSubmit = data => console.log(data);
const firstName = watch('firstName');
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input name="firstName" ref={control.register} />
<input name="lastName" ref={control.register} />
<p>First Name: {firstName}</p>
<button type="submit">Submit</button>
<DevTool control={control} />
</form>
);
}
Redux DevTools is a development tool for Redux that provides a visual interface to inspect and debug Redux state changes. It offers similar functionalities to @hookform/devtools but is focused on Redux state management rather than form state.
React Query DevTools is a development tool for React Query that provides a visual interface to inspect and debug queries and mutations. It offers similar functionalities to @hookform/devtools but is focused on data fetching and caching rather than form state.
MobX React DevTools is a development tool for MobX that provides a visual interface to inspect and debug MobX state changes. It offers similar functionalities to @hookform/devtools but is focused on MobX state management rather than form state.
Performant, flexible and extensible forms with easy to use validation.
This React Component will help you to debug forms when working React Hook Form, and give you more insight about your form's detail.
$ npm install @hookform/devtools -D
import React from 'react';
import { useForm } from 'react-hook-form';
import { DevTool } from '@hookform/devtools';
import './App.css';
const App = () => {
const { register, control, handleSubmit } = useForm({
mode: 'onChange',
});
return (
<>
<DevTool control={control} placement="top-left" />
<form onSubmit={handleSubmit((d) => console.log(d))}>
<h1>React Hook Form DevTools</h1>
<label>Test</label>
<input name="test" ref={register} />
<input type="submit" />
</form>
</>
);
};
export default App;
Thanks goes to all our backers! [Become a backer].
Thanks goes to these wonderful organizations! [Contribute].
Thanks goes to these wonderful people! [Become a contributor].
FAQs
React Hook Form dev tool to help debugging forms
The npm package @hookform/devtools receives a total of 216,971 weekly downloads. As such, @hookform/devtools popularity was classified as popular.
We found that @hookform/devtools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.