A tool for transforming jsx attributes array to object
npm install babel-plugin-jsx-attributes-array-to-objectjs
var a = { color: 'red' };
`
and the configure like this:
`
// babel.config.js
[
syntaxJSX,
[require('babel-plugin-jsx-attributes-array-to-object
'), { attributes: ['style'] }],
]
`
the code will be transformed:
`js
var a = {
color: 'red'
};
var b = {};
color: 'gray'
})}>Usage
$3
`sh
yarn add --dev babel-plugin-jsx-attributes-array-to-object
`
or
`sh
npm install --save-dev babel-plugin-jsx-attributes-array-to-object
`
$3
`js
{
plugins: [
[require('babel-plugin-jsx-attributes-array-to-object'), {
attributes: ['style'],
}]
]
}
``