Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
182 views
in Technique[技术] by (71.8m points)

reactjs - Is it possible to use Formik recursively?

I have an object:

{
  name: 'someName:',
  children: [],
  description: 'someDescription'
}

And I want to push the same object to the children array, so it would become something like this:

{
  name: 'someName:',
  children: [
    0: {
      name: 'someName:',
      children: [],
      description: 'someDescription'
    }
  ],
  description: 'someDescription'
}

The children inside children will have the same structure, so as you can see it will need some kind of recursion logic. I'm trying to add form validation to each of these properties, but I'm unsure if this is possible with Formik.

Has anyone ever done this before and could they share an example or explain how they've done it?

question from:https://stackoverflow.com/questions/65599575/is-it-possible-to-use-formik-recursively

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...