Skip to content

world clock#73

Open
kendigm wants to merge 1 commit intorocketacademy:mainfrom
kendigm:main
Open

world clock#73
kendigm wants to merge 1 commit intorocketacademy:mainfrom
kendigm:main

Conversation

@kendigm
Copy link

@kendigm kendigm commented Oct 31, 2023

i had a hard time trying to create the grid, eventually gave up🤦‍♀️. so i did the UTC instead.

@@ -0,0 +1,44 @@
import React from "react";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File should be capital Clock.js as this is a component. Components always capitalized

this.timeZone = props.timeZone;
// Initialise component state to contain "date" attribute with current date and time
this.state = { date: new Date() };
console.log(props.timeZone);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's always remove console logs before pushing our code, as those are just for debugging

// Save setInterval timer ID in class variable for teardown in another class method
function updateDate() {
this.setState({date: new Date()})
console.log("hi")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove

Comment on lines +4 to +6
constructor(props) {
super(props);
this.timeZone = props.timeZone;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this here is unnecessary. You should just be able to use this.props to access the props from anywhere in the component without defining those in the constructor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants