question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discuss] Maybe we can use react or jsx as DSL

See original GitHub issue

In my opinions, there is not many people use pugjs. And maybe we can use react as second choose. We can write some logic code, like below

const mockData = [{ name: 'stephen', sex: 'male', age: 25 }, { name: 'stephen', sex: 'male', age: 25 }, { name: 'stephen', sex: 'male', age: 25 }, { name: 'stephen', sex: 'male', age: 25 }];

const Item = props => (
  <div>
    <p>name: {props.name}</p>
    <p>sex: {props.male}</p>
    <p>age: {props.age}</p>
  </div>
);

const List = props => (
  <div>
    { mockData.map((item, index) => <Item name={item.name} male={item.male} age={item.age} key={index} />) }
  </div>
);

That is more powerful than just HTML, and can provide kinds of scenes to use.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Zulkocommented, May 19, 2018

This sounds like a completely different project, with different objectives, a different stack, etc. the only common part with the current project would be the pdf generation with pupetteer, and that’s 3 lines. I totally get the appeal though, I’d do one based on Vue if I had time. But by proposing REACT as a framework you are restricting the software to hardcore frontend developers. Pug, on the other hand, has nothing scary about it, anyone with a bit of HTML experience can get started on making documents with it.

0reactions
Zulkocommented, Sep 14, 2019

It seems that there is a consensus not to add the feature, closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discussion on: 2021 JavaScript framework
But you have to basically do the same with any framework using JSX or any other DSL, regardless if it is fully compiled...
Read more >
Replace the term attr by prop · Issue #2 · Zaid-Ajaj/Feliz - GitHub
The original React DSL, is based on JSX (and so HTML) syntax which is a layer on top of react. In JSX, we...
Read more >
JSX In Depth - React
The first part of a JSX tag determines the type of the React element. Capitalized types indicate that the JSX tag is referring...
Read more >
React's JSX Doesn't Violate Separation of Concerns
JSX isn't HTML. It's a DSL (domain specific language) over Javascript. It's Javascript all the way down. There's no HTML here, and React...
Read more >
JSX is inefficient by default … but … | by Andrea Giammarchi
Please don't miss JSX can be more efficient by default post, which explain my journey to achieve awesome performance out of JSX! I've ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found