Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
bloom-context-forms
Advanced tools
Bloom-Context-Forms provides a FormHandler wrapper that manages your internal form state inside React 16's context. All updates, validation, and other hooks are available through connecting your component to the specific Context it consumes.
It's suggested to use this package to manage your form state and validation, and use the Bloom Inputs package for accessible, stylable inputs.
<FormHandler>
and independently.fieldNames
. Allows fully custom inputs without any special wrappers around each of them.FormContext
and its helper methods<FormHandler />
WrapperTo use this package, you can install with either npm or yarn.
npm install bloom-context-forms --save
or
yarn add bloom-context-forms
To import the files/components in this package, import like:
import { FormHandler, getCurrentContext } from 'bloom-context-forms';
Fork this repo, and submit any changes as a PR to master. Accepted PRs will be merged and published to npm.
import { FormHandler } from 'bloom-context-forms';
import LoginForm from './login-form';
class LoginFormContainer extends React.Component {
submitForm = async (formData, files, successCallback, failCallback) => {
// submit formData and files
}
validationHelp = {
dictionary: {
'must-equal-bloop': testData =>
testData !== 'bloop' ? 'Sorry, this field has to be "bloop."' : null
}
}
render() {
const fieldNames = ['username', 'password'];
return (
<FormHandler
fieldNames={fieldNames}
id='loginForm'
submitForm={this.submitForm}
validationHelp={this.validationHelp}
>
<LoginForm />
</FormHandler>
)
}
}
The above component can be written in the renderProps style like so:
// same as above
...
render() {
const fieldNames = ['username', 'password'];
return (
<FormHandler
fieldNames={fieldNames}
id='loginForm'
submitForm={this.submitForm}
validationHelp={this.validationHelp}
>
{formHandlerProps => <LoginForm { ...formHandlerProps } />}
</FormHandler>
)
}
}
This can be useful when you need to access the props passed down to children directly your Container's render method.
import { connectForm } from 'bloom-context-forms';
const LoginForm = () => { ... };
export default connectForm(LoginForm);
The distinction between container and presentational component is to separate state and data-calling functionality from markup.
Container: Connects the component to the form context state; Submits data to the API; Updates state as needed Presentation Component: Uses functionality passed down from parent containers; Focus is purely presentational / view layer
If you don't want to use this method, use the renderProps example above to access your needed methods directly on rendering.
FAQs
context-wrapped form functionality for your bloom projects
The npm package bloom-context-forms receives a total of 5 weekly downloads. As such, bloom-context-forms popularity was classified as not popular.
We found that bloom-context-forms 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.