React AI Hey Nick!
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import {add, subtract, multiplication, divide} from './Owngreet'
ReactDOM.render(
<>
<App/>
</>
,
document.getElementById('root'));
app.js
import React from 'react';
// import Greetings from './Owngreet'
function App()
{
let curDate = new Date(2020,5,5,10);
curDate = curDate.getHours();
let greeting = '';
let cssStyle = {};
if(curDate > 1 && curDate < 12 )
{
greeting = 'Good Morning';
cssStyle.color = 'skyblue';
}
else if(curDate > 13 && curDate <17)
{
greeting = 'Good afternoon';
cssStyle.color = 'yellow';
}
else if(curDate > 17 && curDate <20)
{
greeting = 'Good evening';
cssStyle.color = 'green';
}
else if(curDate > 20 && curDate <24)
{
greeting = 'Good Night';
cssStyle.color = 'blue';
}
else
{
greeting = 'Invalid'
}
return(
<>
<div className = 'backcolorst'>
<h1>Hey Nick ! <span style={cssStyle}>{greeting}</span></h1>
</div>
{/* <Greetings/> */}
</>
);
}
export default App;
Comments
Post a Comment