rsvp-reader/src/components/Options.js

32 lines
698 B
JavaScript
Raw Normal View History

2019-12-13 00:16:53 +01:00
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
2019-12-13 02:05:04 +01:00
import { setMaxLength, setWpm } from '../store/actions'
2019-12-13 00:16:53 +01:00
export const Options = () => {
2019-12-13 00:16:53 +01:00
const dispatch = useDispatch()
2019-12-13 02:05:04 +01:00
const maxLength = useSelector(state => state.maxLength)
const wpm = useSelector(state => state.wpm)
2019-12-13 00:16:53 +01:00
return (
<div>
<input
type="range"
min="3"
max="14"
value={maxLength}
onChange={e => dispatch(setMaxLength(e.target.value))}
/>
{maxLength}
2019-12-13 02:05:04 +01:00
<input
type="range"
min="100"
max="1000"
value={wpm}
onChange={e => dispatch(setWpm(e.target.value))}
/>
{wpm}
2019-12-13 00:16:53 +01:00
</div>
)
}