i got this problem i need help " this.state.pages.filter is not a function" this is the code -->
class BlockEditor extends React.Component {
constructor(props) {
super(props);
this.state = {
pages: '',
editor: false,
page: '',
pageId: props.match.params.pageId
}
}
componentDidMount() {
servicePage.getPage()
.then( res => {
this.setState({
pages : res
});
if( this.state.pageId ) {
this.state.pages.filter(page => page._id === this.state.pageId).forEach(page =>
this.setState({
page : page
})
)
}
})
}