This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Profile({ navigation }) { | |
React.useEffect(() => { | |
const unsubscribe = navigation.addListener('focus', () => { | |
// Fetch profile data | |
}); | |
return unsubscribe; | |
}, [navigation]); | |
return <ProfileContent />; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initState = { | |
theme: 'default' | |
} | |
const Reducer = (state=initState,action) => { | |
switch (action.type){ | |
case "CHANGE_THEME": | |
return { | |
...state, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { useDispatch } from 'react-redux' | |
const AnotherChildComponent = () => { | |
const dispatch = useDispatch() | |
function changeTheme (theme) { | |
dispatch({ | |
type: 'CHANGE_THEME', | |
theme: theme |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
const Component1 = props => { | |
return <p>{props.theme}</p> | |
} | |
const Component2 = props => { | |
return <Component1 theme={props.theme}/> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initUserState = { | |
isAuth: false, | |
isAuthModalOpen: false | |
} | |
const initGalleryState = { | |
selectedPhotoURL: "" | |
} | |
const UserReducer = (state=initUserState,action) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React,{useState} from 'react'; | |
import {useSelector} from 'react-redux'; | |
const ChildComponent = () => { | |
const appTheme = useSelector(state => state.theme) | |
return ( | |
<div> | |
<p>{appTheme}</p> | |
</div> | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initState = { | |
theme: 'default' | |
} | |
const Reducer = (state=initState,action) => { | |
return state; | |
} | |
export default Reducer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
import * as serviceWorker from './serviceWorker'; | |
import Reducer from './Reducer' | |
import { createStore } from 'redux'; | |
import { Provider } from 'react-redux'; | |
const store = createStore(Reducer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
import PaymentModal from './PaymentModal/PaymentModal'; | |
function App() { | |
return ( | |
<div className="App"> | |
<PaymentModal | |
// Use a unique value for the orderId | |
orderId={45896588} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
button { | |
padding: 2%; | |
background-color: yellow; | |
} |