-
Notifications
You must be signed in to change notification settings - Fork 934
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
SDK openProject TypeScript + React #1238
Comments
Is this even possible nowadays? |
Haven't looked at this in a while, but it seems the sdk.openProject({
template: "create-react-app",
title: "React + TS",
description: "Basic React + TS Template",
dependencies: {
"@types/react": "latest",
"@types/react-dom": "latest",
},
files: {
"public/index.html": `<div id="root"></div>`,
"src/style.css": `h1, p {
font-family: Lato;
}`,
"src/App.tsx": `import * as React from 'react';
import './style.css';
export default function App() {
return (
<div>
<h1>Hello StackBlitz!</h1>
<p>Start editing to see some magic happen :)</p>
</div>
);
}
`,
"src/index.tsx": `import * as React from 'react';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';
const rootElement = document.getElementById('root');
const root = createRoot(rootElement);
root.render(
<StrictMode>
<App />
</StrictMode>
);
`,
},
}); That said, it is probably easier to reference an existing GitHub project using I didn't try it, but it might be possible to use a GH project with the In terms of this issue, it does seem reasonable to have a React/TS project option that works out of the box. In particular it would be great if you could reference the starter projects that exist in the web app. |
I agree totally. As for your sample it seems that the create-react-app template wants an index.ts and not a .tsx |
Hm, it seems to work fine as is in the snippet. Here is some unedited example output: https://stackblitz.com/edit/react-z9msve?file=src%2Findex.tsx Using sdk version 1.9.0. |
Hi there, I'm not sure if this is a feature request or I am missing something in docs.
I was hoping to generate a React/TS project on the fly using the JS SDK. I can use
sdk.openProject
with one of the existingtemplate
strings, but there is no template string that supports React/TS so far as I can tell.It seems like this project already has TS/React working. Is there a way to leverage the same environment when creating a new project via the SDK?
The text was updated successfully, but these errors were encountered: