✨ Get all templates and new upcoming releases for just $69. Limited time offer ✨

Import and use React components

Cruip CSS

If you are familiar with React you don’t need to read this chapter.

Every time you want to use a React component, it needs to be imported first. So, for example, let’s see how you can import a component (a button component) into another component (a page component). Following code shows a page component 👇

// Page component, for example /src/views/Page.js

import React from 'react';
import Button from '../components/elements/Button';

class Page extends React.Component {
  render() {
  
    return (
      <Button>My button</Button>
    );
  }
}

export default Page;

You can learn more about importing components on the Create React App documentation.

Last updated on August 17, 2021