Gathering detailed insights and metrics for @truefit/bach-formik
Gathering detailed insights and metrics for @truefit/bach-formik
Gathering detailed insights and metrics for @truefit/bach-formik
Gathering detailed insights and metrics for @truefit/bach-formik
npm install @truefit/bach-formik
Typescript
Module System
Node Version
NPM Version
TypeScript (72.14%)
JavaScript (27.86%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
16 Commits
1 Watchers
3 Branches
8 Contributors
Updated on Jun 15, 2021
Latest Version
2.1.0
Package Id
@truefit/bach-formik@2.1.0
Unpacked Size
18.75 kB
Size
7.37 kB
File Count
20
NPM Version
7.6.3
Node Version
15.11.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
17
This library allows components composed with @truefit/bach to idiomatically use Formik
npm install @truefit/bach-formik formik
or
yarn add @truefit/bach-formik formik
Allows you to specify that the composed component should be wrapped in a Formik element. This enhancer uses the Formik component.
Helper Signature
Parameter | Type | Description |
---|---|---|
formikProps | js object | a js object containing the props to pass to the formik element - see formik documentation for full list |
Example
1import React from 'react'; 2import {compose, withCallback} from '@truefit/bach'; 3import {withFormik} from '@truefit/bach-formik'; 4import {FormikProps} from 'formik'; 5 6type FormValues = { 7 name: string; 8 address: string; 9 age: number; 10}; 11 12type Props = { 13 handleFormSubmit: () => void; 14 formik: FormikProps<FormValues>; 15}; 16 17const WithFormik = ({formik: {values, handleChange, handleBlur}, handleFormSubmit}: Props) => ( 18 <div> 19 <input name="name" onChange={handleChange} onBlur={handleBlur} value={values.name} /> 20 <input name="address" onChange={handleChange} onBlur={handleBlur} value={values.address} /> 21 <input name="age" onChange={handleChange} onBlur={handleBlur} value={values.age} /> 22 23 <button type="submit" onClick={handleFormSubmit}> 24 Submit 25 </button> 26 </div> 27); 28 29export default compose( 30 withFormik({ 31 initialValues: {name: 'John Doe', address: '', age: 0}, 32 onSubmit: (values: FormValues) => { 33 console.log(values); // eslint-disable-line 34 }, 35 }), 36 37 // this is needed to handle the type disparity between formik and onClick 38 withCallback<Props>('handleFormSubmit', ({formik: {handleSubmit}}: Props) => () => { 39 handleSubmit(); 40 }), 41)(WithFormik);
1import React from 'react'; 2import {compose} from '@truefit/bach'; 3import {withFormik} from '@truefit/bach-formik'; 4 5const WithFormik = (formik: {values, handleChange, handleBlur, handleSubmit}) => ( 6 <div> 7 <input 8 name="name" 9 onChange={handleChange} 10 onBlur={handleBlur} 11 value={values.name} 12 /> 13 <input 14 name="address" 15 onChange={handleChange} 16 onBlur={handleBlur} 17 value={values.address} 18 /> 19 <input 20 name="age" 21 onChange={handleChange} 22 onBlur={handleBlur} 23 value={values.age} 24 /> 25 26 <button type="submit" onClick={handleSubmit}> 27 Submit 28 </button> 29 </div> 30); 31 32export default compose( 33 withFormik({ 34 initialValues: {name: 'John Doe', address: '', age: ''}, 35 onSubmit: values => { 36 console.log(values); // eslint-disable-line 37 }, 38 }), 39)(WithFormik);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
15 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More