Tech, From Scratch

Override React Component Render in Jest Test

If the component is the default export: jest.mock(“./MyComponent”, () => () => <div>Hello World</div>); If the component is a named export: jest.mock(“./MyComponent”, () => ({ MyComponent: () => <div>Hello World</div> }));


Follow My Blog

Get new content delivered directly to your inbox.

Design a site like this with WordPress.com
Get started