'use strict';

var slicedToArray = require('../../slicedToArray-BcL7fKuL.js');
var React = require('react');
require('../../unsupportedIterableToArray-BoHMiKNA.js');

var useStateWithDependency = function useStateWithDependency(defaultValue) {
  var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [defaultValue];
  var _useState = React.useState(defaultValue),
    _useState2 = slicedToArray._slicedToArray(_useState, 2),
    value = _useState2[0],
    setValue = _useState2[1];
  React.useEffect(function () {
    setValue(defaultValue);
  }, dependencies);
  return [value, setValue];
};

module.exports = useStateWithDependency;
//# sourceMappingURL=useStateWithDependency.js.map
