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 './styles.css' | |
| function App() { | |
| const pediatricians = [ | |
| 'Michael Lopez', | |
| 'Sally Tran', | |
| 'Brian Lu', | |
| 'Troy Sakulbulwanthana', | |
| 'Lisa Wellington', |
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 List({ groupName, members = [] }) { | |
| return ( | |
| <div> | |
| <h5> | |
| Group: <em>{groupName}</em> | |
| </h5> | |
| <ul> | |
| <p>Members</p> | |
| {members.map((member) => ( | |
| <li key={member}>{member}</li> |
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 List from './List' | |
| function App() { | |
| return <List /> | |
| } | |
| export default 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
| function List(props) { | |
| return <div>{props.children}</div> | |
| } | |
| function App() { | |
| return ( | |
| <List> |
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 List(props) { | |
| return ( | |
| <div> | |
| <h5> | |
| Group: <em>Pediatricians</em> | |
| </h5> | |
| <ul> | |
| <p>Members</p> | |
| <li>Michael Lopez</li> | |
| <li>Sally Tran</li> |
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
| { | |
| "id": "u_k8q16rjx_fgrw6b0yb528unp3trokb", | |
| "license": { | |
| "id": "m_k8q16rjk_jipoch164dsbpnwi23xin", | |
| "client": { | |
| "firstName": "sally", | |
| "lastName": "tran", | |
| "id": "b_k8q16rjk_0xfqodlst2wqh0pxcl91j" | |
| }, | |
| "preparer": { |
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 dic = new DIC() | |
| dic.register('frogOwner', Client) | |
| dic.register('frogOwnerLicense', sallysLicense) | |
| dic.register('frog', mikeTheToad) | |
| dic.factory('frog-owner', FrogParadiseOwner) | |
| const frogOwner = dic.get('frog-owner', [ | |
| 'frogOwner', | |
| 'frogOwnerLicense', | |
| 'frog', |
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
| class DIC { | |
| constructor() { | |
| this.dependencies = {} | |
| this.factories = {} | |
| } | |
| register(name, dependency) { | |
| this.dependencies[name] = dependency | |
| } | |
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
| // Update here only by passing the dependency to the DIC | |
| const dic = new DIC() | |
| dic.register('frogOwner', Client) | |
| dic.register('frogOwnerLicense', sallysLicense) | |
| dic.register('frog', mikeTheToad) | |
| dic.factory('frog-owner', FrogParadiseOwner) | |
| const frogOwner = dic.get('frog-owner') |
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 frogOwner = new FrogParadiseOwner(Client, sallysLicense, mikeTheToad) | |
| // some other location | |
| const frogOwner2 = new FrogParadiseOwner(...) | |
| // some other location | |
| const frogOwner3 = new FrogParadiseOwner(...) | |
| // some other location | |
| const frogOwner4 = new FrogParadiseOwner(...) | |
| // some other location | |
| const frogOwner5 = new FrogParadiseOwner(...) |