
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@zzwing/react-form-wrapper
Advanced tools
npm install @zzwing/react-form-wrapper
import FormWrapperHoc from '@zzwing/react-form-wrapper'
FormWrapperHoc(WrappedComponent, defaultState)
WrappedComponent can get formWrapper from this.props
| name | type | desc |
|---|---|---|
| itemWrapper | (element: JSX.Element, opt: FormItemWrapperOpt) => JSX.Element | wrap component |
| getState | () => state | getState from wrapper |
| setWrapperState | (state, callback) => void | setState like React.setState |
| name | type | desc | default |
|---|---|---|---|
| valuePropName | string | name for wrapped's value prop, eg: checked | value |
| getValueFromEvent | (e: any) => any | change event to value | (e) => e.target[valuePropName] |
| defaultValue | any | set defaultValue once when value is undefined | undefined |
| eventTrigger | string | custom event trigger, eg: onCheck, onChange | onChange |
import * as React from 'react'
import FormWrapperHoc, { FormWrapperHocProp } from '@zzwing/react-form-wrapper'
class Form extends React.PureComponent<FormWrapperHocProp> {
render() {
const { itemWrapper, getState } = this.props.formWrapper
// use itemWrapper to wrap sub-comp
const Input = itemWrapper('valueKey')(<input />)
const value = getState().valueKey
return (
<>
{Input}
you can get value for {key}
</>
)
}
}
type PlainObject = {
[key: string]: any;
}
interface FormItemWrapperOpt {
valuePropName?: string
getValueFromEvent?: (e: any) => any
defaultValue?: any
eventTrigger?: string
}
interface FormItemWrapper {
(key: string, props?: FormItemWrapperOpt): (
element: JSX.Element
) => JSX.Element
}
interface FormWrapperHocRef<T = any> {
setWrapperState: (state: T) => void
getState: () => T
}
type PropWithRef<P> = P & {
getRef?: (arg: FormWrapperHocRef) => void;
}
function FormWrapperHoc<
P = any,
T extends PlainObject = PlainObject
>(
Wrapped: React.ComponentType<any>,
initialState?: T
): React.ComponentClass<PropWithRef<P>>
}
FAQs
A react form component HOC
We found that @zzwing/react-form-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.