Skip to content

Basic React App Stopwatch and Timer#1

Open
dariuscox wants to merge 6 commits into
mainfrom
timer
Open

Basic React App Stopwatch and Timer#1
dariuscox wants to merge 6 commits into
mainfrom
timer

Conversation

@dariuscox
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@SirGoose3432 SirGoose3432 left a comment

Choose a reason for hiding this comment

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

🐕

Comment thread react-intervaler/package.json Outdated
Comment thread react-intervaler/src/App.jsx Outdated
Comment thread react-intervaler/src/App.jsx Outdated
import Timer from './components/Timer'
import Error from './components/Error';
import Navigation from './components/Navigation';
import 'bootstrap/dist/css/bootstrap.min.css';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use styled components instead of importing stylesheets

https://bootstrap-styled.github.io/bootstrap-styled/

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Bootstrap styled is not supported with typescript

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I will style components a different way

Comment thread react-intervaler/src/App.jsx Outdated
console.log(timer)
}

useEffect(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can turn this entire useEffect into it's own custom hook. Then call it both in Timer and Stopwatch

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

it differs between the two however, i guess i can rewrite it to take in a up or down or something from state??? maybe??

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's good to turn hooks into something that is generic so that you can reuse them between components. It also lets you test then outside of the component that uses them.

End of day, we want to use hooks because it allows us to separate code that is presentational and code that contains "business logic" as well as test them independently of each other.

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