index.js — react Source File
Architecture documentation for index.js, a javascript file in the react codebase. 0 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 9fdca11b_70ed_a288_1347_ba7a20f86c41["index.js"] 1e5e2b9e_6833_e5eb_b802_91874b6cf675["App.js"] 1e5e2b9e_6833_e5eb_b802_91874b6cf675 --> 9fdca11b_70ed_a288_1347_ba7a20f86c41 style 9fdca11b_70ed_a288_1347_ba7a20f86c41 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
const React = window.React;
const fixturePath = window.location.pathname;
/**
* A simple routing component that renders the appropriate
* fixture based on the location pathname.
*/
class FixturesPage extends React.Component {
static defaultProps = {
fixturePath: fixturePath === '/' ? '/home' : fixturePath,
};
state = {
isLoading: true,
error: null,
Fixture: null,
};
componentDidMount() {
this.loadFixture();
}
async loadFixture() {
const {fixturePath} = this.props;
try {
const module = await import(`.${fixturePath}`);
this.setState({Fixture: module.default});
} catch (error) {
console.error(error);
this.setState({error});
} finally {
this.setState({isLoading: false});
}
}
render() {
const {Fixture, error, isLoading} = this.state;
if (isLoading) {
return null;
}
if (error) {
return <FixtureError error={error} />;
}
return <Fixture />;
}
}
function FixtureError({error}) {
return (
<section>
<h2>Error loading fixture</h2>
<p>{error.message}</p>
</section>
);
}
export default FixturesPage;
Domain
Subdomains
Functions
Classes
Imported By
Source
Frequently Asked Questions
What does index.js do?
index.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in index.js?
index.js defines 1 function(s): FixtureError.
What files import index.js?
index.js is imported by 1 file(s): App.js.
Where is index.js in the architecture?
index.js is located at fixtures/dom/src/components/fixtures/index.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/dom/src/components/fixtures).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free