Senior Full Stack Developer (React + Golang) Interview Prep
React (Frontend)
- Render Props vs HOCs
Render Props: Share code via a prop that is a function.
HOC (Higher Order Component): A function that takes a component and returns a new one.
Difference: HOCs wrap components; render props pass functions. Render props offer more composability.
- Lazy Loading
Use React.lazy and Suspense:
const LazyComponent = React.lazy(() => import('./Component'));
<Suspense fallback={<Spinner />}><LazyComponent /></Suspense>
- Performance Bottlenecks
Use React DevTools Profiler. Avoid re-renders with React.memo, useMemo, useCallback. Split large components;
minimize DOM updates.
- useMemo vs useCallback
useMemo(fn, deps): Memoizes function result.
useCallback(fn, deps): Memoizes function reference.
Use useCallback to prevent unnecessary re-renders.
- Redux Toolkit vs Context
Redux Toolkit: For large apps with complex state.
Context API: Lightweight, good for theme/static states.
- Optimistic UI Updates
Update UI before server confirmation. Revert on error. Example: Show added todo item immediately.
- Preventing XSS
Avoid dangerouslySetInnerHTML. Use DOMPurify. Set CSP headers.
- Secure JWT Storage
Best: HttpOnly cookies. Avoid localStorage/sessionStorage for sensitive tokens.
Senior Full Stack Developer (React + Golang) Interview Prep
- Testing Async API
Use jest.mock. Use waitFor or findBy* with React Testing Library.
- Jest Test Sample
test('increments', () => {
render(<Counter />);
fireEvent.click(screen.getByText('Increment'));
expect(screen.getByText('1')).toBeInTheDocument();
});
Golang (Backend)
- Goroutines & Channels
Goroutines: go func() {}
Channels: ch := make(chan int)
val := <-ch
- Race Conditions
Prevent with sync.Mutex or channel-based communication.
- REST API Example
Use gin-gonic/gin:
r := gin.Default()
r.GET('/users/:id', getUser)
- Middlewares
r.Use(func(c *gin.Context) {
log.Println(c.Request.URL)
c.Next()
})
- REST vs gRPC
REST: Human-friendly, JSON, HTTP.
gRPC: Fast, HTTP/2, protobuf. Good for microservices.
Senior Full Stack Developer (React + Golang) Interview Prep
- gRPC Compatibility
Add new fields as optional. Dont change tags or remove fields.
- Prevent SQL Injection
Use prepared statements:
db.Query('SELECT * FROM users WHERE id = ?', id)
- gorm vs database/sql
gorm: Easier, ORM.
database/sql: More control, better performance.
- Handler Unit Test
req := httptest.NewRequest(...)
w := httptest.NewRecorder()
handler(w, req)
assert.Equal(t, 200, w.Code)
- httptest Role
Simulates HTTP requests/responses for testing without a real server.
System Design
- Crypto Wallet Service
Use microservices with gRPC. HSM for key management. PostgreSQL for ledgering, Redis for caching. Secure APIs.
- Notification System
Kafka/NATS for events, Redis pub/sub or WebSockets for real-time. Store notifications in DB.
Behavioral Questions
- Refactoring Legacy Code
Modularized code, added tests, used feature flags for gradual rollout.
- Handling Disagreements
Senior Full Stack Developer (React + Golang) Interview Prep
Listen actively, use data, seek compromise with stakeholders.
- Security Issue Experience
Found input validation flaw, patched it, added tests and code reviews.