Skip to content

Commit

Permalink
style: use React.Children.toArray
Browse files Browse the repository at this point in the history
  • Loading branch information
nil1511 authored and Almouro committed Jan 7, 2019
1 parent e9fcaf1 commit 49e84b4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/withNextInputAutoFocus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import PropTypes from "prop-types";
import { isArray } from "lodash";
import withFormik from "./withFormik";

const withNextInputAutoFocusContextType = {
Expand All @@ -10,7 +9,7 @@ const withNextInputAutoFocusContextType = {
};

const getInputs = children =>
(isArray(children) ? children : [children]).reduce((partialInputs, child) => {
React.Children.toArray(children).reduce((partialInputs, child) => {
if (child && child.props && child.props.children) {
return partialInputs.concat(getInputs(child.props.children));
}
Expand Down

0 comments on commit 49e84b4

Please sign in to comment.