0

I have a class called Tab which has three props:

  • num: string
  • desc: string
  • parts: Part[]

where Part has this code in Tab.tsx:

interface Part {
    desc: string,
    link: string
}

But when I create a Tab in Menu.tsx (the parent), I am unsure how to define the parts attribute.

<Tab num="1" desc="Description" parts=? />

How do I go about this?

1
  • 1
    parts is an array of objects parts={[{desc: 'bla', link: 'foo'}]} Commented Dec 20, 2021 at 19:16

1 Answer 1

2

parts is an Array of objects in the shape of { desc: string; link: string; }.

Pass it this way: [{ desc: "foo", link: "bar" }, { desc: "foo", link: "baz" }].

Example:

<Tab
 num="1"
 desc="Description"
 parts={[{ desc: "foo", link: "bar" }, { desc: "foo", link: "baz" }]}
/>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.