
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@bedrockstreaming/form-context
Advanced tools
`form-context` is a React reducer solution to manage steps.
form-context
is a React reducer solution to manage steps.
Since we are using react-hook-form
to persist data locally, we are only storing the form data and step information on each step submission.
:::note
You can avoid to store any form data if you wish
:::
npm install @bedrockstreaming/form-context
import { useEffect } from 'react';
import { FormBuilder } from '@bedrockstreaming/form-builder';
import {
getCurrentStepIndex,
isLastStep,
resetForm,
initForm,
setNextStep,
useFormsDispatch,
useFormsState,
FormProvider,
} from '@bedrockstreaming/form-context';
import { schema, formId } from './path/to/my/config';
import { fooSubmitAction } from '<my-app-module>';
const FooForm = () => {
const dispatch = useFormsDispatch();
const state = useFormsState();
const currentStepIndex = getCurrentStepIndex(formId)(state);
const shouldSubmit = isLastStepSelector(formId)(state);
const previousValues = getFormData(formId)(state);
useEffect(() => {
dispatch(initForm(formId, schema));
}, [dispatch]);
const handleSubmit = useSubmit(formId);
const handleNextStep = (fieldsValues: FieldValues) => {
dispatch(updateFormData(formId, fieldsValues));
dispatch(setNextStep(formId));
};
const handleSubmit = (fieldValues: FieldValues) => {
if (shouldSubmit) {
fooSubmit(fieldValues);
dispatch(resetForm(formId));
} else {
dispatch(setNextStep(formId));
}
};
return (
<FormBuilder
dictionary={dictionary}
schema={schema}
onSubmit={handleSubmit}
handleNextStep={handleNextStep}
currentStepIndex={currentStepIndex}
/>
);
};
export const FormContainer = () => {
return (
<FormsProvider>
<Form />
</FormsProvider>
);
};
Run nx test form-context
to execute the unit tests via Jest.
FAQs
`form-context` is a React reducer solution to manage steps.
The npm package @bedrockstreaming/form-context receives a total of 25 weekly downloads. As such, @bedrockstreaming/form-context popularity was classified as not popular.
We found that @bedrockstreaming/form-context demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.