-
Notifications
You must be signed in to change notification settings - Fork 0
Implementation
ZoltanTabi edited this page Mar 13, 2021
·
2 revisions
Use if you want to use states
import { useSelector } from 'react-redux';
import { RootState } from '../redux';
const labelState = useSelector((state: RootState) => state.labelState);
Use for async action call
import { useDispatch } from 'react-redux';
const dispatch = useDispatch();
dispatch(ACTION)
Use for navigate to other screen
Example:
import { useNavigation } from '@react-navigation/native';
navigation.navigate('CameraScreen');
Example with params:
import { useNavigation } from '@react-navigation/native';
navigation.navigate('CameraScreen', {
message: 'message from MapScreen'
});
Use if you give a params.
import { useRoute, RouteProp } from '@react-navigation/native';
const route = useRoute<RouteProp<{ params: { message: string } }, 'params'>>();
const message = route.params?.message;
import { FC, ReactElement } from 'react';
const COMPONENTNAME: FC<INTERFACE> = ( props: INTERFACE): ReactElement => { return() }
import { useState } from 'react';
const [stateName, stateChangeFunctionName] = useState<INTERFACE>(INTERFACE implemented);
stateChangeFunctionName(INTERFACE implemented);