It seems that react-templates does not work with styled-components. I have the following error:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of MyComponent.
Here is my code :
component.js
import React, { Component } from 'react';
import P from './P';
import template from './index.rt.html';
export default class MyComponent extends Component {
render() {
return template();
}
};
P.js
import styled from 'styled-components';
const P = styled.p`
color: red;
`;
export default P;
Hello!
It seems that react-templates does not work with
styled-components
. I have the following error:Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of MyComponent.
Here is my code : component.js
P.js
index.rt.html
Do you know what's wrong? Thanks!