nivendha
nivendha

Reputation: 837

wrapWithStyles(...): A valid React element (or null) must be returned

I am able to render the component well without 'isomorphic-style-loader' but i get this warning when exported using withStyles()

"Warning: wrapWithStyles(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object."

I have enclosed the component with a parent 'div'

// MyComponent.js
import React from 'react';
import PropTypes from 'prop-types';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Header.scss';

function MyComponent(props, context) {
  return (
    <div className={s.root}>
      <h1 className={s.title}>Hello, world!</h1>
    </div>
  );
}

export default withStyles(MyComponent,s); 

// MyComponent.scss
.root { padding: 10px; }
.title { color: red; }

Upvotes: 0

Views: 103

Answers (0)

Related Questions