JS + React Interview
JS + React Interview
1. New tags in HTML 5 - audio, video, svg, header, footer, nav, figure, progress,
2. New attributes in HTML 5 - form>input>'placeholder', input>type='email',
3. In-line and block level elements
CSS
1. CSS Selectors - element tag(div), class(.), id(#), universal(*), Combinator(space, >, +, ~),
pseudo-class selector(a:hover), pseudo-element selector(h1::after), attribute
selector(a[target])
2. preprocessors - SASS/scss
3. @mixin vs placeholder
4. Grid vs FlexBox vs floats vs position -
https://medium.com/@madhur.taneja/css-layouts-cced6c7a8764
5. CSS box model - position, margin, border, padding, content
6. Manipulate CSSDOM through JS
7. display(inline, block, inline-block,flex, grid, none) and position(static(default, top bottom
left right do not work), relative, absolute, fixed, sticky)
8. How to center a div - display: flex, align-items: center, justify-content: center
9. CSS overlay - container{position: relative}, element{position: absolute, z-index: 10},(imp:
z-index works only on positioned elements and flex items)
10. Css scroll - overflow, overflow-x, overflow-y - values - hidden, auto, scroll, visible(default,
renders outside visible area)
11. Visibility: hidden vs display: none
12. @media query - @media screen and (condition){style}
13. CSS Animations - @keyframes - tbd
Styled-Components
1. Why use styled-components - react like solution for issues like style/class clashing in
css, scss practice.
2. Css-in-js libraries - use js/es6 to dynamically tailor css style exclusive for particular react
component and generate unique class names in runtime.
3. styled.element`{}`, styled(reactComponent)`{}`, css`{}`, as={component}
4. keyframes
JS Concepts
TS Concepts
1. Generic <Type>
2. Inference
3. Type casting - x as Type, <Type>x
4. Type alias vs interface - type: any, non-extendable, Interface: only objects, extendable,
implementable
5. Union |, Intersection & of type aliases and interfaces.
6. unknown vs any - use unknown at the time of typing and cast at the time of assigning is
better than any, any should be avoided at any cost.
7. Tuples - a typed array with a pre-defined length and types for each index
8. Readonly - type check that makes array/tuples immutable at compile type
React concepts
Next.js concepts
Unit Testing
1. Jest
a. Describe(), beforeAll(), afterEach(), test/it(), expect(enzyme
selector).matcher(value)
b. Mock function - jest.fn(),
c. Mock module - jest.mock() //not required if automocking enabled,
func.mockImplementation(()=> {})
2. Enzyme
a. JSDOM is a JavaScript based headless browser that can be used to create a
realistic testing environment.
b. Render component into JSDOM
i. Shallow - shallow(<Component />)
ii. Full Dom - mount()
iii. Static - render()
c. Selectors - find(selector), selector can be class, id, element tag, React
component with props
Storybook
NFR
1. Accessibility - A, AA, AAA. tools - Screen reader - NVDA
2. Security -
3. Performance - Lighthouse, Profilers
4. Localization
5. Scalability
React Native
1. Animation
2. Routing
3. Core components
4. View vs ScrollView