Package Exports
- react-camelize-props
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-camelize-props) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-camelize-props
Sometimes you receive props from back-end with keys in snake_case, but you are using a linter to check if you are calling object's keys in camelCase form. You have two options: 1) ask the back-end to convert keys to camelCase before sending to your client code; 2) Convert yourself before assigning props to your own components.
react-camelize-props
is a HOC to help us with this. It will read your
component's props, convert each key to camelCase and then reassign those props
back to your component.
Getting started
yarn add react-camelize-props
or
npm install --save react-camelize-props
Usage
import React from 'react';
import camelizeProps from 'react-camelize-props';
const User = ({ firstName, lastName }) => (
<div>{firstName} {lastName}</div>
);
export default normalizeProps(User);