Skip to content

Support Render Props #88

Open
Open
@ezhlobo

Description

@ezhlobo

What is "Render Props"?

https://reactjs.org/docs/render-props.html

It's important to use this because Context API works via this approach. React is currently testing hooks, which will simplify the whole work with pug, but still we need to either have a good support of it or add information to the README.

How it works now

So now we support this way to use render props:

function render(item) {
  return pug`
    p= item
  `
}

const test = pug`
  Child
    ${item => pug`
      p item
    `}
    
  Prop(children=${item => pug`
    p item
  `})
  
  ExternalChild
    = render
    
  ExternalProp(children=render)
`

Check it out

How to improve?

I'm happy to know any crazy idea to make it more attractive in use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions