score:0
where on earth are propname and componentname defined?
those are parameters that get passed in to your function by the prop-types library. propname is the name of the prop that's being tested ("text"
in this case) and componentname is the name of the component ("message"
in this case);
here's the line in prop-types which calls your function
you can control what value is used for componentname by adding a displayname property to your component, as in:
const message = ({text}) => <p>{text}</p>
message.displayname = "aardvark";
if no .displayname
is provided, then the function's .name
property is used instead (assuming the function isn't anonymous)
Source: stackoverflow.com
Related Query
- When are the props `propName` and `componentName` passed to the `PropTypes` functions?
- react-google-maps map not updated when passed props and the marker is one location behind when updated
- React and Typescript: Convention for classes when no props are being passed
- React Router: props aren't passed down when directly accessing the URL of child component. Will I need to use the same state in both parent and child?
- React: Tell child component to "reinitialize," even when the passed props are the same
- Are the properties in {...rest} being passed down to {routeProps} when passing props in react-router?
- React functional stateless component, PureComponent, Component; what are the differences and when should we use what?
- What are the differences between Redux-Thunk and Redux-Promise when used with Axios apis?
- How to mock functions, and test that they're called, when passed as props in react components?
- Why are my props `undefined` when using redux and react.js?
- When and how are React lifecycle methods called in the NextJS SSR process?
- why react props are passed undefined to the child component?
- NextJS bug: Component props are undefined when building the project (everything works fine on dev mode)
- How to optimize React components with React.memo and useCallback when callbacks are changing state in the parent
- When calling super() in custom view, make sure to pass up the same props that your component's constructor was passed
- p5.js and React: how to update a sketch inside a component when one of the component's props is updated
- Why are my props not being passed into my component when mount rendering?
- When are the React PropTypes checks executed?
- What are the difference between reactJS props and refs?
- Missing the location, history and match properties when combining custom props with RouteComponentProps
- Current and next props are the same in componentWillReceiveProps call
- React functional components in Array.map are always rerendering when getting passed a function as props
- Next.js parts of my React components HTML code are in the wrong place when compiled and ran
- How to handle routing when both front end and back end are on the same server
- Why React component is not update when the props passed to it changes?
- React's behaviour when pass through props are named the same as other props
- React loading HOC: all the props provided in a list are set to optional and if any of them is undefined shows a spinner instead of the component
- How do I reset component's states to default when new props are passed in?
- Link props when passed does not work when browser back and forth is clicked React router v4
- what is making props behavior inconsistent when set as a variable and passed into another function
More Query from same tag
- Type 'Element[]' is not assignable to type 'ReactElement<any>'
- How to prevent '#' be converted to '%23' in Next/Link?
- Next.js: How do you pass data to a route created dynamically
- React: Ternary operation in JSX produces "Unexpected token" error
- call instance method from higher order component in react
- How to get only key value pairs in nested object in javascript
- Google places autocomplete inside a react component
- react native modal: Button on press calls a prop function and resets the state?
- React property not appearing as query parameter
- How to persist intermittent text on `react-select`?
- Why can React hooks be used conditionally with throw errors?
- How to register only once in react useEffect and get useState changes
- Error with module parsing- Webpack
- Using styled-jsx with postcss, styles not reloading/rebuilding
- Creating a Toolbar with both Left and Right Justified Elements with Material UI and React.js
- Am I not allowed to pass props from outside of the map function?
- Nested routes react-router v6
- Filter object with multiple string values
- How to reverse walk a tree structure
- React Fetch to Laravel API Creates New Session
- React PropTypes - shape with numbers as keys
- Is export {default} from './Component' valid ES6
- How can I get pagination work on Meteor 1.5.2 with react?
- Material-ui Autocomplete defaultValue not working
- Cannot handle state of checkbox upon page reload in React
- ReactNative: How to check if the user has granted permission to gps
- How to import typescript file into script tag
- Q: react-router - component rendering - maybe logic wrong
- React - pass child value as props
- Within a parent component, is there any way I can access a prop from a child component?