1

I keep getting the following error within my ASP.NET MVC 5 solution with React.NET Error while loading "~/Scripts/jsx/components/HomeComp.jsx": TypeError: Object doesn't support property or method 'createClass' at Global code (Script Document:6:1) Line: 6 Column:1 when trying to server side render a react component return within my MVC view. I have bundled all the necessary scripts and tried including the following within my web configs along with adding the following refs to my layout view

@using React.Web.Mvc;
@using System.Web.Optimization;
@using System.Web.Optimization.React;

but I keep getting the same error, I'm guessing its got to do with the way I have setup my solution, any help will be much appreciated. I have shared the project via my google drive for a better understanding. https://drive.google.com/drive/folders/1LCIlQRZNGckYKWbT4fwp1XDrW0lHZ8t9?usp=sharing

1 Answer 1

2

It sounds like you're trying to use the legacy React.createClass syntax. This is no longer supported by React out-of-the-box. Try using the newer syntax with React.Component instead. See https://reactjs.org/docs/react-component.html for example.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Daniel, thanks for a great tutorial on reactjs.net/getting-started/tutorial.html. I got the samme error as above after following your guide. Is there a new version to the tutorial that includes waht you are saying here?
I haven't had time to update the tutorial :( Maybe someone will submit a pull request to update it, otherwise I can do it if/when I get some free time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.