Skip to content

Commit

Permalink
feat(Templates): update react and jest-react starter templates to use…
Browse files Browse the repository at this point in the history
… the new jsx runtime
  • Loading branch information
hatemhosny committed Jan 21, 2024
1 parent a5cb868 commit 2e5b9d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
14 changes: 6 additions & 8 deletions src/livecodes/templates/starter/jest-react-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export const jestReactStarter: Template = {
autotest: true,
markup: {
language: 'html',
content: `
<div id="app">Loading...</div>
`.trimStart(),
content: '',
},
style: {
language: 'css',
Expand All @@ -33,12 +31,11 @@ export const jestReactStarter: Template = {
script: {
language: 'jsx',
content: `
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import { useState } from "react";
export const increment = (count) => (count ?? 0) + 1;
export default function App(props) {
function Counter(props) {
const [count, setCount] = useState(0);
return (
<div className="container">
Expand All @@ -51,8 +48,9 @@ export default function App(props) {
);
}
const root = createRoot(document.querySelector("#app"));
root.render(<App name="Jest with React" />);
export default function App() {
return <Counter name="Jest with React" />;
}
`.trimStart(),
},
tests: {
Expand Down
12 changes: 6 additions & 6 deletions src/livecodes/templates/starter/react-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const reactStarter: Template = {
activeEditor: 'script',
markup: {
language: 'html',
content: '<div id="app">Loading...</div>\n',
content: '',
},
style: {
language: 'css',
Expand All @@ -25,10 +25,9 @@ export const reactStarter: Template = {
script: {
language: 'jsx',
content: `
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import { useState } from "react";
function App(props) {
function Counter(props) {
const [count, setCount] = useState(0);
return (
<div className="container">
Expand All @@ -40,8 +39,9 @@ function App(props) {
);
}
const root = createRoot(document.querySelector("#app"));
root.render(<App name="React" />);
export default function App() {
return <Counter name="React" />;
}
`.trimStart(),
},
stylesheets: [],
Expand Down

0 comments on commit 2e5b9d1

Please sign in to comment.