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.

Can i generate some TSX/JSX code somehow?

See original GitHub issue

Let’s say I want to generate a function which returns some TSX, like:

export default function Layout({ children }) {
  return (
    <html>
      <head>
        <title>my website</title>
      </head>
      <body>
        <div id='root'>{children}</div>
        <script src='/assets/bundle.js'></script>
      </body>
    </html>
  );
}

how would I define the function body? The only method I have found for now is using a multiline string and call setBodyText() with it. Also, modifying eg: stuff within the <head></head> in a clean way would be really awesome! Is there any support for TSX planned?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
virus2016commented, Oct 28, 2020

Hey @dsherret,

Any update on this one? Could we help in any way?

P.S. Our whole team loves this project too!

7reactions
dsherretcommented, Sep 28, 2019

@ryanhaney thanks for the compliments!

Yeah, I had stopped working on this because I wasn’t sure about how to deal with these whitespace JSXText elements: https://ts-ast-viewer.com/#code/MYewdgzgLgBFCm0YF4YB4CiAbeBbeYUAfALABQMl62eBsA9KWWvTfoUQNxA

I think I know now, but it’s a bit of work. I’m going to up the priority on this one and start work on it right away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I transform my .tsx files into the .jsx syntax expected ...
I am using ReactJS.NET. I can get the React.Sample.Webpack demo working but I want to modify it to use TypeScript.
Read more >
Using JSX with TypeScript - Minko Gechev
In the code above we defined a component called Demo . It accepts properties, which are instances of the class DemoProps and state,...
Read more >
Working of JSX in TypeScript | Examples - eduCBA
This is a guide to TypeScript JSX. Here we discuss the introduction, working of JSX in TypeScript along with examples respectively.
Read more >
TSX and ES6 - WebStorm Guide - JetBrains
Make a new file · Put it in VCS · Cut the type and function from App.tsx · Paste those into the new...
Read more >
How to Use JavaScript React Components within TypeScript ...
We also learn how we can make interfaces from React prop types. ... Input.tsx ... By using code given above may get us...
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