How to use the @umijs/hooks.useDynamicList function in @umijs/hooks

To help you get started, we’ve selected a few @umijs/hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github didi / nightingale / web / src / pages / Monitor / Collect / CollectForm / PLUGINForm.tsx View on Github external
const { getFieldProps, getFieldDecorator } = props.form;

  if (initialValues.env) {
    try {
      const env = JSON.parse(initialValues.env);
      initialValues.env = _.map(env, (value, name) => {
        return {
          name, value,
        };
      });
    } catch (e) {
      console.log(e);
    }
  }

  const { list, remove, getKey, push, resetList } = useDynamicList(initialValues.env);


  useEffect(() => {
    resetList(initialValues.env);
  }, [JSON.stringify(initialValues.env)]);

  getFieldDecorator('collect_type', {
    initialValue: initialValues.collect_type,
  });

  const [submitLoading, setSubmitLoading] = useState(false);

  const handleSubmit = (e: any) => {
    e.preventDefault();
    props.form.validateFields((errors: any, values: any) => {
      if (errors) {