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 Lazycomponent = React.lazy(()=>import('./lazy.component.js')) | |
| function AppComponent() { | |
| return ( | |
| <div> | |
| <Suspense fallback={<div>loading ...</div>}> | |
| <LazyComponent /> | |
| </Suspense> | |
| </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
| //React.lazy() kullanılmadan | |
| import OtherComponent from './OtherComponent'; | |
| const MyComponent = () => ( | |
| <div> | |
| <OtherComponent /> | |
| </div> | |
| ) | |
| //React.lazy() kullanıldığında |
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 Loadable from 'react-loadable'; | |
| const LoadableDescription = Loadable({ | |
| loader: () => import('./Description'), | |
| loading() { | |
| return <div>Loading...</div>; | |
| }, | |
| }); | |
| function App() { |
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 LoadDescription = () => import('./Description'); | |
| class App extends React.Component { | |
| state = { | |
| Description: null, | |
| }; | |
| componentDidMount() { | |
| LoadDescription.then(Description => { | |
| this.setState({ Description: Description.default }); |
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 Description from './Description'; | |
| +const Description = import('./Description'); |
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
| // index.js | |
| export default () => | |
| (<Switch> | |
| <Route path='/about' component={About} /> | |
| <Route path='/products' component = {Products} /> | |
| <Route path='/settings' component = {Settings} /> | |
| </Switch>) | |
| // about.js | |
| class About extends Component{ | |
| render() { |
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
| <input type="number" value="2" min="0" max="40" /> |
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
| PasswordGenerator.propTypes = { | |
| length: PropTypes.number, | |
| digitCount: PropTypes.number, | |
| symbolCount: PropTypes.number, | |
| maxLength: PropTypes.number, | |
| maxDigits: PropTypes.number, | |
| maxSymbols: PropTypes.number | |
| } | |
| PasswordGenerator.defaultProps = { |
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 handleOnChange = (e, name) => { | |
| let value = e.target.value | |
| if(name === 'length'){ | |
| setLength(value) | |
| }else if(name === 'digits'){ | |
| setDigitCount(value) | |
| }else if(name === 'symbols'){ | |
| setSymbolCount(value) | |
| } | |
| } |
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 checkPasswordStrength = () => { | |
| ... | |
| setStrengthScore(10) | |
| setStrengthText('weak') | |
| } | |
| const copyToClipboard = () => { | |
| ... | |
| setCopy(true) | |
| setTimeout(() => { |