Skip to content

Commit

Permalink
add typescript example
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanuelQuintino committed Dec 6, 2023
1 parent 0b2bada commit e4d027a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
12 changes: 6 additions & 6 deletions 6-React/class-02-components/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './pages/App.tsx'
import React from "react";
import ReactDOM from "react-dom/client";
import { App } from "./pages/App.tsx";

ReactDOM.createRoot(document.getElementById('root')!).render(
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
</React.StrictMode>
);
6 changes: 2 additions & 4 deletions 6-React/class-02-components/src/pages/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { CardProfile } from "../components/CardProfile";

function App() {
export function App() {
return (
<>
<h1 style={{textAlign: "center"}}>Class Components</h1>
<h1 style={{ textAlign: "center" }}>Class Components</h1>
<CardProfile gitHub={"EmanuelQuintino"} name={"Emanuel Quintino"} age={30} />
</>
);
}

export default App;
12 changes: 12 additions & 0 deletions 6-React/class-02-components/src/typescript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type User = {
name: string;
age: number;
};

function user(user: User) {
console.log(user);
console.log(user.name);
console.log(user.age);
}

user({ name: "Emanuel", age: 30 });

0 comments on commit e4d027a

Please sign in to comment.