Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: React.createContext is not a function #1101

Closed
rubayethossain opened this issue Jul 3, 2018 · 3 comments
Closed

TypeError: React.createContext is not a function #1101

rubayethossain opened this issue Jul 3, 2018 · 3 comments

Comments

@rubayethossain
Copy link

I am getting a TypeError: React.createContext is not a function when trying to add DragDropContext to component. I am using React v15.6.1 and I am wondering if it's required to use React v16 to use react-dnd since Context introduced in React v16.

Here is my component where I am trying to add DragDropContext.

import React, {Component} from 'react';
import FormSpace from './FormSpace';
import TextItem from './TextItem';
import HTML5Backend from 'react-dnd-html5-backend';
import { DragDropContext } from 'react-dnd';


class AdvancedFormRnd extends Component {
    render() {
        return (
            <div className="container">
                <div className="row">
                    <div className="col-sm-8">
                        <FormSpace/>
                    </div>
                    <div className="col-sm-4">
                        <TextItem/>
                    </div>
                </div>
            </div>
        )

    }
}
export default DragDropContext(HTML5Backend)(AdvancedFormRnd);

<TextItem/> is the component which I want to make Draggable and <FormSpace/> is Droppable component.

This happens if I just import DragDropContext from react-dnd.

@Mangaraju-Velpula
Copy link

Mangaraju-Velpula commented Jul 3, 2018

Update react version to 16 or change react-dnd version to 3.0.2.

Refer this link for latest changes of dnd: https://github.com/react-dnd/react-dnd/releases/tag/v4.0.0

@rubayethossain
Copy link
Author

Thanks @Mangaraju-Velpula. I forgot to check the changelog. Now it's clear. Is there any separate documentation for version 3.0.2 or the current documentation is okay with version 3.0.2?

@Mangaraju-Velpula
Copy link

Current documentation is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants