React Dev tools show my Component as Unknown

后端 未结 4 1942
半阙折子戏
半阙折子戏 2021-01-31 16:14

I have the following simple component:

import React from \'react\'
import \'../css.scss\'

export default (props) => {
  let activeClass = props.out ? \'is-ac         


        
4条回答
  •  萌比男神i
    2021-01-31 16:17

    To add to Michael Jaspers answer, if you want to use a named import (instead of default export), you can do like so:

    const MyComponent = props => 
    export { MyComponent }

    The component will show in React DevTools with the correct name.

    Note: If you had exported the expression directly:

    export const MyComponent = props => 

    This would then show as Anonymous or Unknown in React DevTools

提交回复
热议问题