O'Reilly logo

Learning Web Development with React and Bootstrap by Mehul Bhatt, Harmeet Singh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Namespace components

A namespace component is another feature request that is available in React JSX. I know you'll have a question: what is a namespace component? OK, let me explain.

We know that JSX is just an extension of JavaScript syntax and it also provides the ability to use namespace so React is using JSX namespace pattern rather than XML namespacing. By using the standard JavaScript syntax approach, which is object property access, this feature is useful for assigning components directly as <Namespace.Component/>, rather than assigning variables to access components that are stored in an object.

Let's start by looking at the following show/hide example to have a clear idea about namespace components:

var MessagePanel = React.createClass({ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required