Infosys Certified React Expert
Practice with real exam-pattern questions for Infosys Certified React Expert. Each question includes a detailed explanation to help you understand the concept, not just memorise the answer. Try 10 questions free — no login required.
Full question bank for this exam + 1,357+ others. Cancel anytime.
Join Premium10 Infosys Certified React Expert practice questions with answers
Real Lex exam-pattern multiple-choice questions for the Infosys Certified React Expert certification. Each question includes the correct answer. The full question bank is available to Premium members.
- Question 1
Consider the following code Snippet:
const withValidation = (WrappedComponent, validationFn) => {
return function WithValidation(props) {
const [valid, setValid] = React.useState(false);
const validate = () => {
setValid(validationFn());
};
return (
<WrappedComponent
valid={valid}
validate={validate}
{...props}
/>
);
};
};
const FormComponent = ({ valid, validate }) => (
<div>
<form>
{/* ... form fields ... */}
</form>
<button onClick={validate}>Validate</button>
{valid ? <p>Form is valid</p> : <p>Form is invalid</p>}
</div>
);
const ValidatedFormComponent = withValidation(FormComponent, () => true);
What does the withValidation HOC do for the FormComponent?
- ✓
It adds form validation logic to the FormComponent.
Correct - B
It creates a new form component with validation capabilities.
- C
It demonstrates how to implement a custom form validation hook.
- D
It adds form validation logic to a component using the provided validation function.
- ✓
- Question 2
When using a HOC to wrap a component, which of the following statements is true regarding the component's lifecycle methods?
- ✓
The component's lifecycle methods will be replaced by the HOC's methods.
Correct - B
The component's lifecycle methods will be executed after the HOC's methods.
- C
The component's lifecycle methods will execute first, followed by the HOC's methods.
- D
The component's lifecycle methods and the HOC's methods run in parallel.
- ✓
- Question 3
How can you access the context data within a component using the Context API?
- ✓
By importing the context and calling its getData() method
Correct - B
By wrapping the component with the <Context.Consumer> component.
- C
By using the context property within class componentsBy using the useContext hook within a functional component
- D
By using the useContext hook within a functional component
- ✓
- Question 4
When might you choose to use the "useReducer" hook with context API instead of "useState" hook?
- ✓
When user needs to store simple value that doesn't change frequenctly
Correct - B
When user wants to manage the state of multiple unrelated contexts
- C
When the state transitions are complex and involves multiple sub-states
- D
When user wants to expose the context to wide range of components.
- ✓
- Question 5
What is a potential drawback of using Higher-Order Components (HOCs) for code reuse and logic sharing?
- ✓
They can lead to excessive prop drilling in deeply nested component trees.
Correct - B
HOCs make it difficult to abstract away complex logic from components.
- C
HOCs can introduce naming collisions in larger applications.
- D
HOCs are not compatible with modern React features like Hooks.
- ✓
- Question 6
What does the dispatch function return after an action is dispatched in useReducer()?
- ✓
Updated state
Correct - B
Action type
- C
Previous state
- D
undefined
- ✓
- Question 7
Which of the following statements about the Provider component in React's Contect API is true?
- ✓
The Provider component is used to consume the context within child component.
Correct - B
The Provider component is used to create a new context.
- C
The provider component is used to provide the context to its children and takes a "value" prop.
- D
The Provider component is not essential for using the Context API
- ✓
- Question 8
Consider the following Code Snippet
const withLoading = (WrappedComponent) => {
return function WithLoading(props) {
const [loading, setLoading] = React.useState(true);
React.useEffect(() => {
setTimeout(() => {
setLoading(false);
}, 2000);
}, []);
return loading ? <p>Loading...</p> : <WrappedComponent {...props} />;
};
};
const DataComponent = () => <p>Data Loaded!</p>;
const WrappedDataComponent = withLoading(DataComponent);
What does the withLoading HOC do to the DataComponent?
- ✓
It creates a HOC that delays rendering until data is loaded
Correct - B
It demonstrates how to handle loading states using a Hook.
- C
It creates a HOC that renders "Data Loaded!" immediately.
- D
It illustrates how to use a HOC to fetch remote data.
- ✓
- Question 9
class RenderPropComponent extends Component {
render() {
const { renderLogic } = this.props;
return (
<div>
<h1>Render Prop Example</h1>
{renderLogic("Hello from RenderPropComponent!")}
</div>
);
}
}
class App extends Component {
render() {
return (
<div>
<RenderPropComponent
renderLogic={(content) => <p>{content}</p>}
/>
</div>
);
}
}
export default App;
Explain how the `RenderPropComponent` communicates the "Hello from RenderPropComponent!" content to be rendered.
Assume: All imports are done.
- ✓
The content is directly specified in the `render` prop.
Correct - B
The `App` component uses a Redux store to pass the content.
- C
The `RenderPropComponent` fetches the content from an external API.
- D
The `App` component passes the renderLogic function which can receive the content passed by RenderPropComponent and display it.
- ✓
- Question 10
Consider the below code snippet:
class HoverTracker extends Component {
state = {
isHovered: false,
};
handleMouseEnter = () => {
this.setState({ isHovered: true });
};
handleMouseLeave = () => {
this.setState({ isHovered: false });
};
render() {
const { render } = this.props;
const { isHovered } = this.state;
return (
<div
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
>
{render(isHovered)}
</div>
);
}
}
class App extends Component {
render() {
return (
<HoverTracker
render={(isHovered) => (
<div>
<p>Hover over me to see magic happen!</p>
{isHovered && <p>Hey! You're hovering over me!</p>}
</div>
)}
/>
);
}
}
export default App;
what does the `render` prop in the `HoverTracker` component represent?
Note: Assume all imports are done.
- ✓
A function that returns JSX content
Correct - B
The hover state of the `HoverTracker` component.
- C
The CSS style to be applied when hovering.
- D
A callback function for handling mouse events.
- ✓
More in UI
Pay once. Clear every cert this year.
One subscription, full Telegram channel access, every PDF posted during your membership.
- Full access to all 1,357+ certifications
- Monthly updated question banks
- Telegram private channel access
- Cancel anytime
- Everything in Monthly
- Save ₹2,100 vs monthly billing
- Priority answer key requests
- Best for increasing DQ score fast
- Everything in Quarterly
- Lifetime channel access — no renewals
- All future certifications included
- Priority response from admin team
Common questions, straight answers.
A monthly-updated Telegram channel where we post real exam-pattern question banks and detailed answer keys for 1,357+ Infosys Lex certifications. You join once, you get every PDF posted during your membership.
Right after payment on our Graphy page, you'll receive a private invite link to the Telegram channel. Access is instant — usually under 30 seconds.
We compile question banks from the actual Lex test pattern, sourced and verified by 180K+ community members who've recently cleared these exams. Match rate is consistently 85–95%.
Every single month. When Infosys rolls out new versions of certifications, we post updated dumps within 7–10 days. You'll see channel activity weekly.
Clearing certifications is one of the highest-weighted DQ factors. Members typically clear 3–5 certifications in their first 3 months, which moves DQ scores up by a full band.