Solve – cors problem


app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});

app.get('/', function(req, res, next) {
  // ....
});

app.post('/', function(req, res, next) {
 // ....
});



React createElement – Warning: Unknown prop `childItems` on

The following command creates an element in React.


    const el = React.createElement(
                 < an html tag or react component >, 
                 < attributes or props or {} >, 
                 < children elements or text >
    )

When you pass a non html standard attributes in the second parameter to create html tag like div or p tag then a warning is raised of unknown prop. Simply remove the non standard attribute from the second parameter or pass empty object {}.

npm – Refusing to install gulp as a dependency of itself

Yeah, if the name of the package in package.json is “gulp”, then it will throw error. The name of the package is created when we run:

    npm init

“name”: “gulp”.

In other words the name of directory in which you are running the command will give a default package name and you need to change it, don’t leave to default.

Or simple edit the name in package.json to something other than gulp.

SOLVED – jQuery(‘selector’).on is not a function

The jquery function jQuery(‘selector’).on is not available in old version of jQuery than 1.9.

.live() removed

The .live() method has been deprecated since jQuery 1.7 and has been removed in 1.9. We recommend upgrading code to use the .on() method instead. To exactly match $("a.foo").live("click", fn), for example, you can write $(document).on("click", "a.foo", fn). For more information, see the .on() documentation. In the meantime, the jQuery Migrate plugin can be used to restore the .live() functionality.