# tableberg/1.2.0/admin/src/inc/Route.jsx

Tableberg – Simple Gutenberg Table Block, version 1.2.0. 61 lines.

- Page: https://pluginprobe.com/plugins/tableberg/1.2.0/code/admin/src/inc/Route.jsx
- Raw: https://pluginprobe.com/plugins/tableberg/1.2.0/raw/admin/src/inc/Route.jsx
- Modified: 2026-09-16T03:30:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tableberg/1.2.0/code/admin/src/inc/Route.jsx#L10-L20`.

```jsx
import React from "react";

/**
 * Route default options.
 *
 * @type {Object}
 */
export const defaultRouteOptions = {
    path: null,
    title: "no_title",
    element: null,
};

/**
 * Route object.
 *
 * @param {Object} options route options
 * @class
 */
function Route(options) {
    const { path, title, element } = { ...defaultRouteOptions, ...options };
    /**
     * Get route path.
     *
     * @return {string} path
     */
    this.getPath = () => path;

    /**
     * Get route title.
     *
     * @return {string} title
     */
    this.getTitle = () => title;

    /**
     * Get route element.
     *
     * @return {Function} element
     */
    this.getElement = () =>
        element ?? <div>no element defined for route [{this.getPath()}]</div>;
}

/**
 * Generate options array from settings objects.
 *
 * These settings objects should correspond to Route default options.
 *
 * @param {Array<Object>} optionsArray options array
 * @return {Array<Route>} route object array
 */
export const generateRouteArray = optionsArray => {
    return optionsArray.map(options => new Route(options));
};

/**
 * @module Route
 */
export default Route;

```
