Can i generate some TSX/JSX code somehow?
See original GitHub issueLet’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:
- Created 6 years ago
- Reactions:5
- Comments:13 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @dsherret,
Any update on this one? Could we help in any way?
P.S. Our whole team loves this project too!
@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.