react-z / react-timer Goto Github PK
View Code? Open in Web Editor NEWA simple react timer component
A simple react timer component
Hi, Great work,
I suggest specializing this component to only show the timer. Remove action buttons out of component and allow developer full custom control of component start, stop and reset actions. Is this possible?
I will already have to do this in order to have better control of the start, reset, and stop buttons for a mobile app that will have those buttons on a specialized footer. Let me know your thoughts on this and whether it is pull request worthy. If not, no worries, I will customize myself for my needs.
Great component, keep it simple and Thanks for your contribution.
When I run the TestComponent example from README.md
I'm receiving a Syntax Error @ line 7:6:
let OPTIONS = { ... }
Here's the full code:
import Dropdown from 'react-timer'
import ReactDOM from 'react-dom'
import React, { Component, PropTypes } from 'react'
class TestComponent extends Component {
/* delay is just the delay on showing the update of the timer */
let OPTIONS = { prefix: 'seconds elapsed!', delay: 100}
render () {
return (
<div>
<Timer options={OPTIONS} />
</div>
)
}
}
ReactDOM.render( <TestComponent />, document.getElementById('root') )
I had to make a few edits to TestComponent in order for the code to compile successfully. Am I missing something?
My changes to TestComponent
:
import Timer from 'react-timer';
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
class TestComponent extends Component {
/* delay is just the delay on showing the update of the timer */
constructor(props) {
super(props);
this.state = {
options: {
prefix: 'seconds elapsed!',
delay: 100
}
}
}
render () {
return (
<div>
<Timer options={this.state.options} />
</div>
)
}
}
ReactDOM.render( <TestComponent />, document.getElementById('app') );
Let me know what you think, if I'm incorrect in my assumption, or if I'm not reading the example correctly.
Thanks!
You should add a demo, then people can quickly see if this is what they want.
How might react-timer be adjusted to count up (stopwatch) instead of count down (timer)? Thanks
Hi,
I'd like to be able to save how many seconds have passed. For example, I might send this value to my server. Then when the timer loads, it could put "Seconds Passed" into props.
Is this feature possible?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.