This file contains 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 getDayName(dateString) { | |
const date = new Date(dateString); | |
const options = { | |
weekday: 'long' | |
}; | |
return new Intl.DateTimeFormat('en-Us', options).format(date); | |
} |
This file contains 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, { Component } from "react"; | |
import { connect } from "react-redux"; | |
import { toggleSwitch } from "./UiReducer"; | |
class Toggle extends Component { | |
render() { | |
const { ui, toggleSwitch } = this.props; | |
return ( | |
<div> | |
<div>{JSON.stringify(ui)}</div> |
This file contains 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 { connect } from "react-redux"; | |
import { toggleSwitch } from "./UiReducer"; | |
const Toggle = ({ ui, toggleSwitch }) => ( | |
<div> | |
<div>{JSON.stringify(ui)}</div> | |
<input type="checkbox" value={ui.toggle} onChange={toggleSwitch} /> | |
</div> | |
); |
This file contains 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 { connect, useSelector } from "react-redux"; |
This file contains 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 Toggle = ({ toggleSwitch }) => { | |
const ui = useSelector(state => state.ui); | |
return ( | |
<div> | |
<div>{JSON.stringify(ui)}</div> | |
<input type="checkbox" value={ui.toggle} onChange={toggleSwitch} /> | |
</div> | |
); | |
}; |
This file contains 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 { connect, useSelector } from "react-redux"; | |
import { toggleSwitch } from "./UiReducer"; | |
const Toggle = ({ toggleSwitch }) => { | |
const ui = useSelector(state => state.ui); | |
return ( | |
<div> | |
<div>{JSON.stringify(ui)}</div> | |
<input type="checkbox" value={ui.toggle} onChange={toggleSwitch} /> |
This file contains 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 { useSelector, useDispatch } from "react-redux"; |
This file contains 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 Toggle = ({ toggleSwitch }) => { | |
const ui = useSelector(state => state.ui); | |
const dispatch = useDispatch(); | |
return ( | |
<div> | |
<div>{JSON.stringify(ui)}</div> | |
<input | |
type="checkbox" | |
value={ui.toggle} | |
onChange={() => dispatch({ type: TOGGLE })} |
This file contains 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
dispatch({ type: TOGGLE }) |
This file contains 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
export const TOGGLE = "ui/toggle"; |
OlderNewer