Not able to get emoji in React SSR

Viewed 83

I am using this Emoji in my project. I am calling it under the class component but getting the error

TypeError: Cannot convert undefined or null to object
    at getPrototypeOf (<anonymous>)

My react is in SSR

On my code this is the implememtation:

import Picker from 'emoji-picker-react';

class Post extends React.Component{
  constructor(props, context) {
    super(props, context);
    this.state = {
      chosenEmoji: null,
      setChosenEmoji: null,
    }
 }

 onEmojiClick = (event, emojiObject) => {
    this.setState({ chosenEmoji: emojiObject });
 }

 render(){
  return (
    <div>
      <Picker onEmojiClick={this.onEmojiClick} />
    </div>
  )
 }
}

I have debugged by changing the state key to '' or [] but everytime got the different different error

When I am changing state key to empty

this.state={
  chosenEmoji: '',
  setChosenEmoji: '',
}

I got this message:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. at ReactDOMServerRenderer.render

Can anyone guide me how to use emoji on the SSR

0 Answers
Related