You are on page 1of 3

Create a generic type of this

interface IMovable {
left: number
right: number
back: number
forward: number
}
interface ICar {
left: func
right: func
back: number
forward: number
horn: func
}
interface ICrane {
left: number
right: number
back: number
forward: number
pull: func
}

Have you heard of Utility types?


<Partial> <ReadOnly>
https://www.typescriptlang.org/docs/handbook/utility-types.html
Potential Answer
interface ICar extends Omit<IMovable, 'left', 'right'> {
left: func
right: func
horn: func
}

interface ICar extends Omit<IMovable, 'left', 'right'> { left: func right: func horn: func }
interface IMovable { left: number right: number back: number forward: number } interface ICar { left: number right:
number back: number forward: number horn: func }
type IMovable { left: number right: number back: number forward: number } type ICar { left: number right: number
back: number forward: number horn: func }

What are we doing here? Explain the next type


Generic type:
type User = { name: string password: string address: string phone: string }
type MyType<T> = { [P in keyof T]?: T[P] }
What will be my user?
type MyUser = MyType<User>
type MyUser = ?

What are the results for typeof?


const arr = [1,2,3,4]
const x = arr.map(//..)
const y = arr.forEach(//..)
const z = arr.reduce(//..)

typeof x
typeof y
typeof z

What is the difference between interfaces and types?


What does [?] do in an object?
What is the difference between obj.key vs obj[key] ?

Recreate the resultExample using the array provided (you can use reduce or something
else):

const arr = [
{ color: 'white', id: 3 },
{ color: 'red', id: 0 },
{ color: 'blue', id: 1 },
{ color: 'red', id: 2 },
{ color: 'red', id: 4 }
];
const resultExample = {
'white': {
3: { color: 'white', id: 3 }
},
'blue': {
1: { color: 'blue', id: 1 }
},
'red': {
0: { color: 'red', id: 0 },
2: { color: 'red', id: 2 },
4: { color: 'red', id: 4 }
},
}

Have you worked with decorators?


What are the principles of SOLID?
What types do you know in JavaScript?
What are classes?
Do you know algorithms and time complexity?
How do CRUD methods map with HTTP Methods?
What is the difference between PUT and PATCH?
Can you add a Body in a GET request?
What is a JWT token?
Have you worked with WebSockets?
What experience do you have with testing?
What is the difference between unit testing and integrations testing?
Have you used the react-testing library?
Have you done E2E
What Software Design Patterns do you know?
Have you heard of / do you know
- OOP
- SOLID
- DRY
- KISS
- YAGNI)

React Hooks
Given the code below, how would you add animals from farm to state of animals.
const [animals, setAnimals] = useState([])
const farm = [«cow», «rabbit», «dog»]

How would you add cat to state?

const [animals, setAnimals] = useState([«cow», «rabbit», «dog»])


const cat = "cat";

How do the following useEffect map with the component lifecycle?


1. useEffect(() => {},[])
2. useEffect(() => {},[x])
3. useEffect(() => {})
4. useEffect(() => { return x},[])

What is useRef used for?


What is the difference between useMemo and useCallback?
Have you used error Boundaries?
Have you used profilers?
What are the react component lifecycle’s?
Have you worked with Redux?

You might also like