Skip to content

Commit

Permalink
feat: ✨exemple
Browse files Browse the repository at this point in the history
  • Loading branch information
GoupilJeremy committed Jun 28, 2023
1 parent 1380f42 commit 9d23dd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
5 changes: 2 additions & 3 deletions react-book/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Header from '../components/header/Header';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import styles from './app.module.scss';

import NxWelcome from './nx-welcome';

export function App() {
return (
<div>
<NxWelcome title="react-book" />
<Header title='hello' person='Jérémy' />
</div>
);
}
Expand Down
19 changes: 15 additions & 4 deletions react-book/src/components/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import React from 'react'
import React, { useState } from 'react'

interface Props {
title: string
url: string
person: string
}

const Header = (props: Props): JSX.Element => {
return (<h1>
{props.title}
</h1>)
const { title, person } = props

const [newTitle, setNewTitle] = useState<string>(title)

return (
<>
<h1 onClick={() => {setNewTitle('bye bye')}}>
{`${newTitle} ${person}` }
</h1>
<input type='text' value={newTitle} />
</>
)
}

export default Header

0 comments on commit 9d23dd4

Please sign in to comment.