From 7767aedb94a6c5e45644542ef6938447d377d3a3 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Tue, 27 Jul 2021 15:58:56 -0400 Subject: [PATCH] EditStreamScreen [nfc]: Convert to function component. --- src/streams/EditStreamScreen.js | 51 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/streams/EditStreamScreen.js b/src/streams/EditStreamScreen.js index 34d4d08594a..04b56cafb33 100644 --- a/src/streams/EditStreamScreen.js +++ b/src/streams/EditStreamScreen.js @@ -1,5 +1,5 @@ /* @flow strict-local */ -import React, { PureComponent } from 'react'; +import React, { useCallback } from 'react'; import type { RouteProp } from '../react-navigation'; import type { AppNavigationProp } from '../nav/AppNavigator'; @@ -23,31 +23,30 @@ type Props = $ReadOnly<{| ...SelectorProps, |}>; -class EditStreamScreen extends PureComponent { - handleComplete = (name: string, description: string, isPrivate: boolean) => { - const { dispatch, stream } = this.props; - - dispatch(updateExistingStream(stream.stream_id, stream, { name, description, isPrivate })); - NavigationService.dispatch(navigateBack()); - }; - - render() { - const { stream } = this.props; - - return ( - - - - ); - } +function EditStreamScreen(props: Props) { + const { dispatch, stream } = props; + + const handleComplete = useCallback( + (name: string, description: string, isPrivate: boolean) => { + dispatch(updateExistingStream(stream.stream_id, stream, { name, description, isPrivate })); + NavigationService.dispatch(navigateBack()); + }, + [stream, dispatch], + ); + + return ( + + + + ); } export default connect((state, props) => ({