Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive component usage example (draft) #123

Open
ceremcem opened this issue Nov 8, 2017 · 3 comments
Open

Recursive component usage example (draft) #123

ceremcem opened this issue Nov 8, 2017 · 3 comments

Comments

@ceremcem
Copy link
Contributor

ceremcem commented Nov 8, 2017

This is a draft for recursive component usage:

Example: Recursive Boxes

Boxes might contain some other boxes recursively:

boxes: [
  {width: 1, height: 2, boxes:[
      {width: 44, height: 55},
      {width: 66, height: 77, boxes: [
          {width: 88, height:99}
        ]}
    ]},
  {width: 3, height: 5}
]
  1. We can simply display these boxes by using "Partials": Playground link

  2. If we want to display an area property for each box, we may simply use data functions: Playground link

  3. To set height of the boxes by their "virtual" area property, we may use components: Playground link

Changes

  • Reduced number of examples, simplified area component
  • Added buttons to add new boxes to current branch
  • Removed unnecessary component conversion.
@fskreuz
Copy link
Collaborator

fskreuz commented Nov 8, 2017

So TL;DR:

  • Recursive components because you need computed props for each box.
  • Partials + data function/method isn't an option.

Yes? If not, I'm not seeing the reason or goal.

@ceremcem
Copy link
Contributor Author

ceremcem commented Nov 8, 2017

Exactly, 2-way data flow is the main requirement here.

@ceremcem
Copy link
Contributor Author

ceremcem commented Nov 8, 2017

Two goals here:

  1. Demonstration of recursive partial usage
  2. Two way data flow of a virtual property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants