From cf485d5ae4c1b985535e19960d4a6426f1c3166e Mon Sep 17 00:00:00 2001 From: Mickey Puri Date: Mon, 13 Apr 2020 13:20:48 +0100 Subject: [PATCH] Minutes changed to allow incoming ref --- modules/app/Minutes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/app/Minutes.js b/modules/app/Minutes.js index 8c23cac..69b13a7 100644 --- a/modules/app/Minutes.js +++ b/modules/app/Minutes.js @@ -2,7 +2,8 @@ import React, { useState } from "react" import { format as formatDate } from "date-fns" import { FaMinus, FaPlus } from "react-icons/fa" -export default function Minutes({ date }) { +const Minutes = React.forwardRef((props, ref) => { + const {date = null} = props; const [minutes, setMinutes] = useState(30) const subtract = () => { @@ -62,6 +63,7 @@ export default function Minutes({ date }) { className="Minutes_input" value={minutes} id="minutes" + ref={ref} onChange={handleInputChange} onBlur={handleInputBlur} onKeyDown={handleInputKeyDown} @@ -80,4 +82,6 @@ export default function Minutes({ date }) { ) -} +}); + +export default Minutes;