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, {useState} from 'react'; | |
const App = () => { | |
const [fontSize, updateFontSize] = useState(14) | |
} | |
export default App |
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, {useState, useContext} from 'react'; | |
const Context = React.createContext() | |
const App = () => { | |
const [fontSize, updateFontSize] = useState(14); | |
return ( | |
<Context.Provider value={{fontSize: fontSize, updateFontSize: (val) => updateFontSize(val)}}> | |
<Child1></Child1> | |
<Context.Provider> |
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, {useState, useContext} from 'react'; | |
const Context = React.createContext() | |
const App = () => { | |
const [fontSize, updateFontSize] = useState(14); | |
const [fontFamily, updateFontFamily] = useState('Ariel'); | |
const [text, updateText] = useState('Sample'); | |
const providerVal = { | |
fontSize: fontSize, | |
updateFontSize: (val) => updateFontSize(val) |
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, {useState, useContext} from 'react'; | |
const TextContext = React.createContext() | |
const FontContext = React.createContext() | |
const App = () => { | |
const [fontSize, updateFontSize] = useState(14); | |
const [fontFamily, updateFontFamily] = useState('Ariel'); | |
const [text, updateText] = useState('Sample'); | |
const textContext = { | |
text: text, |
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, {useState, useContext, useReducer} from 'react'; | |
const TextContext = React.createContext() | |
const FontContext = React.createContext() | |
const App = () => { | |
const [state, dispatch] = useReducer((prevState, action) => { | |
switch (action.type) { | |
case 'UPDATE_FONT_FAMILY': | |
return { |
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, {useState, useContext, useMemo, useReducer} from 'react'; | |
const TextContext = React.createContext() | |
const FontContext = React.createContext() | |
const App = () => { | |
const [state, dispatch] = useReducer((prevState, action) => { | |
switch (action.type) { | |
case 'UPDATE_FONT_FAMILY': | |
return { |
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 PropTypes from 'prop-types'; | |
import { Button, DatePicker } from 'antd'; | |
const Sample = (props) => { | |
console.log(props) | |
const { onbuttonpress, ...remainingProps } = props | |
return ( | |
<DatePicker {...remainingProps} onChange={(date, dateString) => onbuttonpress({ detail: {date, dateString} })} /> | |
) | |
} |
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
//variables | |
$font-stack: Helvetica, sans-serif; | |
$primary-color: #333; | |
body { | |
font: 100% $font-stack; | |
color: $primary-color; | |
} | |
//nesting |
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
//variables | |
$font-stack: Helvetica, sans-serif; | |
$primary-color: #333; | |
body { | |
font: 100% $font-stack; | |
color: $primary-color; | |
} | |
//nesting |
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
//variables | |
$font-stack: Helvetica, sans-serif; | |
$primary-color: #333; | |
body { | |
font: 100% $font-stack; | |
color: $primary-color; | |
} | |
//nesting |
OlderNewer