Get Started
About Docker Apply custom metadata Docker Deprecated Features Understand the architecture
Image management
Using certificates for repository client verification Run a local registry mirror
Docker run reference Dockerfile reference Remote API client libraries docker.io accounts API Docker Trusted Registry

Creating Components

// use strict by default
'use strict';

/**
 * ES6 import syntax.
 */
import React = from 'react';
import Router, { Link, RouteHandler } = from 'react-router';
import JWTStore from '../stores/JWTStore';

var UserPage = React.createClass({

  /**
   * displayName is used mostly in error messages, but also
   * in the React chrome extension. Always include a 
   * displayName.
   */
  displayName: 'UserPage',

  /**
   * The render function is required. It must return a valid
   * React Element. We are using ES6 syntax to declare the
   * function.
   */
  render() {
    return (
      /**
       * jsx is compiled to function calls. Due to this, there
       * must always be a *single* Element returned in the 
       * render() call
       */
      <div>
          This will be the base wrapper of the 'Users' page where either your or another users profile will appear <br/>
          This will let you see your public facing page at /u/username/ too <br/>
          'Your' homepage/dashboard will live at /home/<br/>
          /**
           * RouteHandler comes from React-Router and displays
           * the sub-route's content (more on this in Routing)
           */
          <RouteHandler />
      </div>
    );
  }
});

var RootUser = React.createClass({
  displayName: 'RootUser',
  render() {
    return (
      <div>
        <p/>
        This is root user page.<br/>
        When not looking at a specific user or an owned image<br/>
        This will show a list of repos/images owned by the root user <br/>
        /**
         * Link is from React-Router and requires the params
         * to be set as an object. The `repo` route is 
         * designated in Routes.jsx
         */
        <Link to='repo' params={{user:'testing', splat:'1234'}}>This could be a image box of some sort</Link>
      </div>
    );
  }
});

var User = React.createClass({
  displayName: 'User',
  /**
   * contextTypes are required to access Fluxible or React-Router
   * functions. In this case, we specify that React-Router is 
   * required for this Element.
   */
  contextTypes: {
    router: React.PropTypes.func.isRequired
  },
  render() {
    return (
      <div>
        <p/>
        /**
         * Using the router from contextTypes:
         */
        This is the UID: {this.context.router.getCurrentParams().uid}<br/>
        This is main user page.<br/>
        This will show a list of repos/images owned by the user <br/>
        <RouteHandler />
      </div>
      );
  }
});

/**
 * Only export one Element per file.
 */
module.exports = {
  userpage: UserPage,
  rootuser: RootUser,
  user: User
};
On this page:
Nov 3, 2015 at 7:59pm (PST) { "docker/compose": { "ref": "docs", "repos": [ "git@github.com:docker/compose.git" ], "sha": "9c8173dbfda93baef214359991b6a8a54172f6ae" }, "docker/docker-hub": { "ref": "master", "repos": [ "git@github.com:docker/hub2-demo.git" ], "sha": "4b2e522c81c860d63b126342a6b981ac0ff1605c" }, "docker/docker-trusted-registry": { "ref": "docs", "repos": [ "git@github.com:docker/dhe-deploy.git" ], "sha": "b8988465878952f2e2c2472e8fc5fd35e5975fbf" }, "docker/docs-base": { "ref": "hugo-github-linking", "repos": [ "git@github.com:docker/docs-base.git" ], "sha": "dc98c0381a6cc311c9e3189dc78a3c7e62e5a205" }, "docker/engine": { "ref": "master", "repos": [ "git@github.com:docker/docker.git" ], "sha": "474b16af8ecfe94ec635dfac60025348d3186aa3" }, "docker/machine": { "ref": "master", "repos": [ "git@github.com:docker/machine.git" ], "sha": "786437901c0c883ecb59c1e0531654c1d89b326d" }, "docker/opensource": { "ref": "master", "repos": [ "git@github.com:docker/opensource.git" ], "sha": "0cd99bcdd876ca0293d8944980c79f32064b6354" }, "docker/registry": { "ref": "master", "repos": [ "git@github.com:docker/distribution.git" ], "sha": "a9da0e510032314910b5405acc50873ab2fa2e5a" }, "docker/swarm": { "ref": "master", "repos": [ "git@github.com:docker/swarm.git" ], "sha": "087e2452f3ec474f112b4e5b8c52b8dacb5751be" }, "docker/tutorials": { "ref": "master", "repos": [ "git@github.com:docker/tutorials.git" ], "sha": "cb55d4de0df55e22f443aac664d66f092f06c56b" }, "docs.docker.com": { "ref": "refs/heads/1-9-release", "repos": [ "git@github.com:moxiegirl/docs.docker.com.git", "git@github.com:docker/docs.docker.com.git" ], "sha": "5878eae5de6f012c67a2a4772327c9948274c351" }, "kitematic/kitematic": { "ref": "master", "repos": [ "git@github.com:kitematic/kitematic.git" ], "sha": "e533ed35d2eab31ce528675b0665f97516b4147b" } }