Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Profile = ({ username, age }) => (
- <div>
- <div>Username: {username}</div>
- <div>Age; {age}</div>
- </div>
- );
- Profile.propTypes = {
- username: string,
- age: number
- };
- // Usage - wrapping the component with the function
- const withFlattenUser = flattenProp('user');
- const ProfileWithFlattenUser = withFlattenUser(Profile);
- // OR
- const ProfileWithFlattenUser = flattenProp('user')(Profile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement