I am pretty new to React Framework, What I am trying to do is that from my Dishdetail.js I am calling the <Commentform /> component so that it displays me a button Submit Comment button. Dishdetail.js is completely fine so I submitted only part of my code from Dishdetail.js so that it doesn't look cluttered. The problem is for my CommentformComponent.js file component I am getting import errors saying
./src/Components/DishdetailComponent.jsAttempted import error: 'Commentform' is not exported from './CommentformComponent'.
I did write my export from my CommentforComponent.js
and here is my full code for CommenforComponent.js file
///THIS IS MY Dishdetail.js file
import {Commentform} from './CommentformComponent';
function RenderComments({comments}){
if(comments!=null){
const dishComments=comments.map( (comment) => {
return(
<ul key={comment.id} className = "list-unstyled">
<p>{comment.comment}</p>
<p>--{comment.author},{new Intl.DateTimeFormat('en-US', { year: 'numeric',month: 'short', day: '2-digit'}).format(new Date(Date.parse(comment.date)))} </p>
</ul>
);
return(
<div>
<h4>Comments</h4>
{dishComments}
<Commentform />
</div>
)
}
else{
return(
<div></div>
);
}
}
///CommentformComponent.js file
import React, {Component} from 'react';
import { Button } from 'reactstrap';
import {Link} from 'react-router-dom';
import {Control,LocalForm,Errors} from 'react-redux-form';
class Commentform extends Component{
render(){
return(
<Button type="submit" color="outline-dark">
<span className="fa fa-pencil fa-lg"></span>Submit Comment
</Button>
);
}
}
export default Commentform;