Topic: What is the best way to use / implement the complex MDB components in React
                                I am running into some challenges using some of the complex MDB components. Here is the error I get:
                                                                
                                
                                                                                                                                                    
                                        
                                
                            
                                                                                ../../MDB/CollapsePage' does not contain an export named 'CollapsePage'
Below is how I implement MDB components. Any feedback or instructions on a better method would be greatly appreciated.
If the MDB component is small, I just import { MDBComponentName } at the top of my React component and then place the <MDBComponentName  /> in the return statement of my React component.  But when the MDB component is complex, like CollapsePage, this is the process I use:
Note: in this example, I'll show you how I tried to implement MDB's Accordion CollapsePage: https://mdbootstrap.com/react/advanced/collapse/#events
- Create a new folder called MDB in my src
 - Create a file in the MDB folder called CollapsePage.js
 - Copy all the code from the CollapsePage example on MDB's website https://mdbootstrap.com/react/advanced/collapse/#events and paste it into my CollapsePage.js
 - Add the following at the top of the CollapsePage.js file: import React, { Component } from "react"; import {Card, Collapse, CardBody } from "mdbreact";
 - I add "export default" in front of "class CollapsePage extends Component"
 - I then navigate to the one of my react components where I want to import and use the newly create CollapsePage component.
 - At the top of my react component, I type import {CollapsePage } from '../.../MDB/CollapsePage'
 - Then I place <CollapsePage /> somewhere in the return statement of my react component and make sure everything is wrapped with a surrounding div.
 
../../MDB/CollapsePage' does not contain an export named 'CollapsePage'
                                                                     
                                                                                            Add comment
                                                                                    
                                                                    
                                                    
                                                    jkilbride
                                                                                        answered 8 years ago                                        
It looks like you're mixing default and named exports. Try removing the brackets from your import statement:
import CollapsePage from '../../MDB/CollapsePage';
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
                            
                            Resolved
Specification of the issue
                                            
        - User: Pro
 - Premium support: No
 - Technology: MDB React
 - MDB Version: -
 - Device: -
 - Browser: -
 - OS: -
 - Provided sample code: Yes
 - Provided link: No