Do you want to request a feature or report a bug?
bug
What is the current behavior?
error:
Invariant Violation
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `App`.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
https://codesandbox.io/s/n5p716r7ol
basically just returning ThemeContext.Provider
seems to cause this weird error. Am I doing this wrong?
import React, {createContext} from 'react';
import { render } from 'react-dom';
import Hello from './Hello';
const ThemeContext = createContext({
background: 'yellow',
color: 'white'
})
const styles = {
fontFamily: 'sans-serif',
textAlign: 'center',
};
const App = () => {
return (<ThemeContext.Provider value={{background:'black'}}>
<div style={styles}>
<Hello name="CodeSandbox" />
<h2>Start editing to see some magic happen {'\u2728'}</h2>
</div>
</ThemeContext.Provider>)
};
render(<App />, document.getElementById('root'));
What is the expected behavior?
it should render correctly even though i havent implemented the consumer ( i also did, but it didnt help)
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
v16.3.0-alpha.1
@sw-yx You will need to set your react-dom dependency to v16.3.0-alpha.1 as well. This will fix the issue.
doh. thanks Gareth :)
@GarethSmall what should the version be if i am having this issue while using react-native
Most helpful comment
@sw-yx You will need to set your react-dom dependency to v16.3.0-alpha.1 as well. This will fix the issue.