This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
const App: React.FC = (): JSX.Element => { | |
return ( | |
<div className="App"> | |
Hi | |
</div> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
interface IAppOwnProps { | |
username: string | undefined; | |
userType: 'admin' | 'moderator' | 'user' | 'guest'; | |
} | |
const App: React.FC<IAppOwnProps> = (): JSX.Element => { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
interface IAppOwnProps { | |
username: string | undefined; | |
userType: 'admin' | 'moderator' | 'user' | 'guest'; | |
} | |
const App: React.FC<IAppOwnProps> = ({userType, username}): JSX.Element => { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import * as serviceWorker from './serviceWorker'; | |
ReactDOM.render(<App userType='admin' username='h4x0r' />, document.getElementById('root')); | |
serviceWorker.unregister(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
interface IAppOwnProps { | |
username: string | undefined; | |
userType: 'admin' | 'moderator' | 'user' | 'guest'; | |
} | |
const App: React.FC<IAppOwnProps> = ({ userType, username }): JSX.Element => { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import './App.css'; | |
interface IAppOwnProps { | |
username: string | undefined; | |
userType: 'admin' | 'moderator' | 'user' | 'guest'; | |
} | |
const App: React.FC<IAppOwnProps> = ({ userType, username }): JSX.Element => { | |
const [time, setTime] = useState<Date>(() => new Date(Date.now())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import './App.css'; | |
interface IAppOwnProps { | |
username: string | undefined; | |
userType: 'admin' | 'moderator' | 'user' | 'guest'; | |
} | |
const App: React.FC<IAppOwnProps> = ({ userType, username }): JSX.Element => { | |
const [time, setTime] = useState<Date>(() => new Date(Date.now())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, ChangeEvent } from 'react'; | |
import './App.css'; | |
interface IAppOwnProps { | |
username: string | undefined; | |
userType: 'admin' | 'moderator' | 'user' | 'guest'; | |
} | |
const App: React.FC<IAppOwnProps> = ({ userType, username }): JSX.Element => { | |
const [time, setTime] = useState<Date>(() => new Date(Date.now())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [message, setMessage] = useState<string>(''); | |
... | |
<input | |
type='text' | |
placeholder='Enter your message here' | |
value={message} | |
onChange={handleTextChange} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, ChangeEvent } from 'react'; | |
... | |
const handleTextChange = (event: ChangeEvent<HTMLInputElement>): void => { | |
setMessage(event.target.value); | |
}; |
OlderNewer