[Shared] Product Engineer Round 2 Assignment_ useCallback
[Shared] Product Engineer Round 2 Assignment_ useCallback
Requirement:
1. Analyze the reference learning experience design table here thoroughly to understand
clearly what kind of activities and use cases are we looking for
a. You’ll need to do this only for the necessary topics needed to fill in the learning
experience design table given below
b. You don’t have to master useCallback hook but the necessary topics you must
know thoroughly
3. Complete the learning experience design table below by filling up (B) and (C) columns
for each of the expected learning outcome provided in (A) column
(A) Expected Learning Outcome (B) Activity or Practical usecase (C) Demo idea or Cod
mentioned)
● You can reorder the entries of (A) column for a better sequence of learning, if needed
■ (C) column to include additional code needed for the activity with any new
syntax or learning clearly called out, in this case
■ (C) column to include details and any code snippets for how to
show/demo this usecase to learners, in this case
■ Note that this has to be in a way which can be shown to learners and not
just explained in words in a tutorialish way
● The activities should form a logical sequence with the same sample application instead
of being disconnected
○ Have the activities mimic real-life scenarios as much as possible so that learners
can apply it easily in other scenarios as well
● (B) column for an expected outcome (A) can have multiple items (activities or practical
usecases) if a single item might become difficult for learners to grasp
3. Attention to detail and ability to design learning content by being in learner’s shoes
● Selection of a good theme/use-case for the entire content using which good set
of activities and practical use cases can be created (eg: A counter application,
Todo application, Stock quotes portfolio)
● Good sequence of activities within and across each expected outcome, fitting in
well like different episodes of a web series
● Right difficulty level of activities with not too much to be learned in any single
activity
Submission
● Start by making a copy of this document and update access so that “Anyone with the
link” can access the doc
// 1 - React.createElement
const element = React.cre
element");
// 2.1 - ReactDOM.render(
// 2.2 - Linking public/index
ReactDOM.render(elemen
const incrementButtonElem
null, "+");
const decrementButtonEle
null, "-");
// 1 - Nesting elements
const containerDivElemen
[counterDisplayElement
decrementButtonElemen
console.log(containerDivE
ReactDOM.render(contain
document.querySelector("
User should be able to add styles to a Activity #3: Write React to add styles to the static // File: src/index.js
React application Counter page from a given CSS file
// 1. Import syntax
import “./styles.css”
User understands the advantage of using Activity #4: Write React code to create a simple // File: src/index.js
JSX over React.createElement to create element (eg: heading) with JSX - show
React elements comparison of React.createElement & JSX const counterDisplayElem
versions { "className": "counter-di
(Note: This along with Activity #3 will drive this
outcome)
// 1. JSX way of creating in
const counterDisplayElem
display">0</h1>)
User should be able to use JSX Activity #5: Write React code to show result of // File: src/index.js
expressions an expression (eg: product of two numbers) on
page using JSX // 1. {} to be used for evalu
const counterDisplayElem
display">{2 * 5}</h1>)
User should be able to use JSX to create a Activity #6: Write React code with JSX for code // File: src/index.js
simple static page in Activity #2 of Milestone #1- show comparison
of React.createElement & JSX versions // v1 - Create individual ele
// 1. Using “{“ to add array
const counterDisplayElem
display">0</h1>)
const incrementButtonElem
const decrementButtonEle
const containerDivElemen
(<div>{[counterDisplayEl
incrementButtonElemen
decrementButtonElemen
User understands the need for components Usecase #1: Needing to display multiple Show how we’ll need to du
counters otherwise with 2 versions
(Note: This along with Usecase #2 will drive this
outcome) // v1 - without components
const containerDivElemen
<div>
<div>
<h1 className="counte
<button>+</button>
<button>-</button>
</div>
<div>
<h1 className="counte
<button>+</button>
<button>-</button>
</div>
</div>
)
ReactDOM.render(contain
document.querySelector("
// v2 - with components
(Note: Learners need not u
just see the difference in li
ReactDOM.render(<Count
document.querySelector("
User should be able to create class Activity #7: Move the Counter static page JSX to // File: src/index.js
component for a simple static page a dedicated “Counter” component
// 1.1. Extending “React.C
// 1.2. JSX to be returned f
class Counter extends Re
render() {
return (
<div>
<h1 className="cou
<button >+</button>
<button>-</button>
</div>
)
}
}
ReactDOM.render(<Count
document.querySelector("
User understands the need for state Usecase #2: To store data within a component Class variables get overwr
ReactDOM.render() calls t
User should be able to create, read and Activity #8: Initialise a state variable in “Counter” // File: src/index.js
update state for a class component component for storing “count” to 0 and display its
value as count on the page // 1. State is initialised insi
constructor(props) {
super(props);
this.state = {
count: 0
};
}