Hey folks, let’s cut to the chase—if you’ve spent any time building React components, you’ve run into that split second where you wonder, “Did this thing even get the prop I passed it?” It’s not just a tiny question either; missing a prop can break forms, hide features, or throw wonky errors that take hours to hunt down. And if you’re using Enzyme to test those components (which, full transparency, is the tool my team supplies—we’ve got years of feedback from devs just like you dealing with this exact headache), then there are solid, repeatable ways to confirm your props are landing exactly where they should. Enzyme

I’ve seen too many devs fumble through this: they’ll mock a prop, fire up a test, and cross their fingers, only to realize the prop never got passed because they named it wrong, or they nested it too deep in a component tree, or even that the component itself is doing something dumb with default props that overrides their test data. Today, I’m walking through the methods that actually work, not the outdated stuff you might see in old blog posts, with real examples I’ve pulled from client projects we’ve supported.
First, let’s set the stage. When we talk about a component receiving a prop, that’s not just about the top-level props you pass when you render the component—it’s about whether that prop is available at the exact part of the component where you need it. For example, if you have a UserAvatar component that takes a user prop, you don’t just care that you passed user={{ name: "Mia", avatar: "mia-pic.jpg" }} when rendering UserAvatar; you care that inside UserAvatar, the Avatar sub-component is actually getting that avatar URL, not some hardcoded default. Enzyme makes this way easier than trying to query the DOM for hidden data attributes, but you have to use the right methods, not just .state() or .find().
Let’s start with the basics: shallow rendering. If you’re unit testing a component, shallow render is non-negotiable—this renders only the component you’re testing, not its children, so you don’t have to dig through multiple layers to check for props. Let’s use a simple example: a Button component that takes a disabled prop. Suppose your component code looks like this:
const SubmitButton = ({ disabled, label }) => {
return <button disabled={disabled}>{label}</button>;
};
A lot of devs will write a test that does something like this:
test('Button receives disabled prop', () => {
const wrapper = shallow(<SubmitButton disabled={true} label="Submit" />);
expect(wrapper.props('disabled')).toBe(true);
});
Wait—does that work? No, actually. I see this mistake all the time. The .props() method returns the full props object of the root node of the shallow render, not a single prop when you pass an argument. That test would throw an error, or if you fix it to wrapper.props().disabled, that works for this simple case, but it falls apart when you’re testing deeper props, especially with full DOM rendering or mount.
The correct approach for shallow, top-level props is to use .prop()—yes, singular, not plural. .prop() takes a string of the prop name, and it returns the value of that prop on the root node of your wrapper. So fixing that test:
test('shallow renders receives disabled prop', () => {
const wrapper = shallow(<SubmitButton disabled={true} label="Submit" />);
expect(wrapper.prop('disabled')).toBe(true);
});
That’s solid for shallow, top-level props. But what if your component has children, and you need to check that a child component received a prop? Let’s adjust our example: the SubmitButton might wrap a custom Icon component, like this:
const SubmitButton = ({ disabled, label }) => {
return (
<button disabled={disabled}>
<Icon name="submit" disabled={disabled} />
{label}
</button>
);
};
Now, if we want to confirm that the Icon component got the disabled prop, .prop() on the root node won’t work—we need to find the Icon first. Enter the .find() method. With shallow rendering, shallow(<SubmitButton />).find(Icon) will return a wrapper for just the Icon component, and then we can call .prop() on that wrapper. So the test becomes:
test('Icon child receives disabled prop', () => {
const wrapper = shallow(<SubmitButton disabled={true} label="Submit" />);
const iconWrapper = wrapper.find(Icon);
expect(iconWrapper.prop('disabled')).toBe(true);
});
This is where a lot of people trip up: if you forget to call .find() to target the child, you’ll accidentally check the button’s disabled prop instead of the Icon’s. And if your test is failing here, don’t just assume your prop is missing—double-check that your component is actually passing that prop to the child. We’ve had a client a few months back who spent three hours debugging a test like this only to realize they’d typed disable instead of disabled in the component, so the test was working, just the component wasn’t. That’s why testing prop flow is as much about your component logic as it is about your test code.
Now, what about full DOM rendering with mount()? Shallow rendering skips child components entirely, which is great for unit tests, but if you’re doing integration tests that need to test how props work across your entire component tree—say, if the SubmitButton gets its disabled prop from a parent Form component—you’ll use mount(). Let’s say our parent Form passes disabled to SubmitButton, which we pass to Icon. With mount, the process is almost the same, but wait—there’s a caveat here. When you use mount, Enzyme renders the full DOM, so you can also check props on HTML elements if that’s what you need, but for custom components, the same .find() + .prop() pattern applies. Let’s test the parent prop flow:
test('Icon receives disabled prop from parent Form', () => {
const wrapper = mount(
<Form initialValues={{}}>
<SubmitButton label="Submit" />
</Form>
);
// First, find SubmitButton, then find Icon inside it
const iconWrapper = wrapper.find(SubmitButton).find(Icon);
expect(iconWrapper.prop('disabled')).toBe(true); // If Form disables when there are unsaved changes, this passes
});
Wait, but what if you’re using TypeScript? A lot of our clients use TypeScript, and they run into issues where .prop() returns type any, which can break type checks. No sweat—there’s a fix. If you know the type of the prop you’re testing, you can add a type assertion, or even better, use shallowWithTypes if you’re using TypeScript 4+ and our Enzyme-compatible tools, which we built specifically to handle those edge cases. That’s one of the perks our users mention most—we don’t just supply the core Enzyme library, we add the small, quality-of-life utilities that fix the stuff that’s a pain point for devs.
Another common scenario: default props. A lot of components have default props set with defaultProps, so you might be wondering, “If I don’t pass a prop, should my test check for the default value?” Let’s clarify: if your test is checking that the component receives a prop you explicitly passed, then default props don’t matter. But if you’re testing that the component falls back to a default when no prop is passed, then .prop() will correctly return the default value. Wait, let’s confirm that with an example. Suppose our Icon component has a default prop for disabled:
Icon.defaultProps = {
disabled: false,
};
If we render Icon without passing disabled, and call iconWrapper.prop('disabled'), it will return false—that’s correct. But if we pass disabled={true}, it returns true, which is also correct. So that’s an important distinction: if your test is verifying that a prop you explicitly passed is received, you’re good to go. If it’s verifying default prop behavior, that works too.
Wait, what about static props? Like if you have a component that uses static propTypes to validate props? Enzyme doesn’t replace propTypes validation, but if you want to test that a component is receiving a prop that matches its propTypes, you can use the .instance() method to get the component instance, and check its props directly. For example:
test('prop type validation works for received props', () => {
const wrapper = shallow(<SubmitButton label="Test" disabled={true} />);
const instance = wrapper.instance();
expect(instance.props.disabled).toBe(true);
// If you pass a wrong prop type, like disabled as a string, React will throw a console warning, which you can test with jest.mock to capture
});
That’s useful if you want to ensure that not only is the prop there, but it’s the right type. Our clients often combine this with their test suites to catch prop type bugs before they make it to production.
Now, let’s talk about common pitfalls to avoid, because even with Enzyme, it’s easy to mess up. First, don’t use the .state() method to check props—.state() is for internal component state, not props. I see this all the time: a dev will call wrapper.state('disabled') expecting the prop, and it will always be undefined, because state and props are separate. Second, don’t rely on text in the DOM to test props—just because a button has the text “Submit” doesn’t mean it got the label prop; the text could be hardcoded. Third, when using .find(), make sure you’re targeting the right component name. If you have two Icon components, or a named export vs a default export, Enzyme’s .find() can have issues if you’re not using the correct import path. For example, if your component is export const Icon = () => {}, you need to import it as import { Icon } in your test, not as import Icon, otherwise wrapper.find(Icon) won’t work. That’s a small gotcha, but it trips up even senior devs sometimes.
Another edge case: functional components with hooks. If you’re testing a component that uses React hooks like useState or useContext, does that change how you test props? No, actually. The .prop() and .find() methods work exactly the same, because hooks don’t alter how props are passed to the component. The only difference is that if you’re using mount(), you’ll want to make sure your test is wrapped in any context providers your component uses, just like your app is. Our Enzyme tools include pre-built context wrappers for common libraries like React Router and Formik, which saves our clients hours of setting up test environments.
Let’s circle back to why this matters. Testing that components receive props isn’t just a “nice-to-have” — it’s part of building reliable UIs. If you don’t confirm props are passing correctly, you might end up with a button that’s supposed to be disabled but isn’t, a user avatar that shows the wrong picture, or a form that submates the wrong data. The methods I’ve walked through are all battle-tested with our clients, who use these same approaches in their production test suites. And since we supply Enzyme solutions that are optimized for React 18, TypeScript, and the latest hook patterns, you can be sure these methods work with the most recent version of React, not the old, deprecated versions that some Enzyme tutorials still reference.
Wait, one more thing: if you’re just getting started with Enzyme, don’t overcomplicate it. You don’t need to use every single method in this guide to test if a component receives a prop. For basic cases, stick with shallow + .prop() for top-level props, and shallow + .find(ChildComponent).prop() for props passed to children. For integration tests that span multiple components, use mount + the same pattern. The rest of the methods are for edge cases, like static props or TypeScript type checks.

If you’re running into issues with prop tests in your own code, or if you’re looking for Enzyme tools that work seamlessly with your existing test setup, our team is here to help. We build solutions that cut down on test flakiness, make prop testing easier, and integrate with whatever stack you’re using. Don’t leave your prop logic to chance—test it properly with the right tools. To discuss your Enzyme needs and find the solution that fits your workflow, reach out to our team to connect and go over your requirements.
Men’s Health Care Raw Material References:
- Enzyme Official Documentation – Testing Props
- React Testing Library vs Enzyme: A Developer’s Guide
- TypeScript and Enzyme: Prop Type Best Practices
- React 18 Component Prop Testing with Enzyme
Xi’an Sentian Biotechnology Co., Ltd.
Xi’an Sentian Biotechnology Co., Ltd. is one of the most professional enzyme manufacturers and suppliers in China, specialized in providing high quality customized service and OEM&ODM private label service. Be free to wholesale bulk enzyme in stock here from our factory. Contact us for free sample.
Address: Jingfa Building, No. 132 Weiyang Road, Weiyang District, Xi’an City, Shaanxi Province
E-mail: sales3@sentianbio.com
WebSite: https://www.sentianherb.com/