Find centralized, trusted content and collaborate around the technologies you use most.

When you create an element and you did not include a prop Making statements based on opinion; back them up with references or personal experience. defaultProps on functional components will eventually be deprecated (as per Dan Abramov, one of the core team), so for future-proofing it's worth using default parameters. How to pass in a react component into another react component to transclude the first component's content? ","line":4,"start":63,"end":82},{"type":"T_IDENTIFIER","context":"normal","value":"bar","line":5,"start":85,"end":88},{"type":"T_COLON","context":"type","value":":","line":5,"start":88,"end":89},{"type":"T_STRING_TYPE","context":"type","value":"string","line":5,"start":90,"end":96},{"type":"T_COMMA","context":"type","value":",","line":5,"start":96,"end":97},{"type":"Line","context":"comment","value":"// bar is required.","line":5,"start":98,"end":117},{"type":"T_RCURLY","context":"type","value":"}","line":6,"start":118,"end":119},{"type":"T_SEMICOLON","context":"normal","value":";","line":6,"start":119,"end":120},{"type":"T_CLASS","context":"normal","value":"class","line":8,"start":122,"end":127},{"type":"T_IDENTIFIER","context":"normal","value":"MyComponent","line":8,"start":128,"end":139},{"type":"T_EXTENDS","context":"normal","value":"extends","line":8,"start":140,"end":147},{"type":"T_IDENTIFIER","context":"normal","value":"React","line":8,"start":148,"end":153},{"type":"T_PERIOD","context":"normal","value":". It means, use default parameters and not "defaultProps", if you care about the maintainability of your project. utility types. // but we have a default prop for foo. React.Component is a generic type that takes two type By Trending is based off of the highest score sort and falls back to it if no posts are trending. 465), Design patterns for asynchronous API communication. If you would like to add a type annotation to defaultProps you can define the props add a static defaultProps property to your class. Someone actually cross-referenced this answer in my own reply, see.

such as babel-plugin-react-flow-props-to-prop-types if you want both It is generally better practice to have default prop objects created separately, eg. Defining series before enumitem list starts, What's the difference between a magic wand and a spell. types. Early in Reacts history the library provided PropTypes which performed Is there a political faction in Russia publicly advocating for an immediate ceasefire? Remember, ReactJS was invented before ES6. misusing a component without running your code. To type default ","line":17,"start":296,"end":297},{"type":"T_IDENTIFIER","context":"normal","value":"count","line":17,"start":297,"end":302},{"type":"T_PLUS","context":"normal","value":"+","line":17,"start":303,"end":304},{"type":"T_NUMBER","context":"normal","value":"1","line":17,"start":305,"end":306},{"type":"T_COMMA","context":"normal","value":",","line":17,"start":306,"end":307},{"type":"T_RCURLY","context":"normal","value":"}","line":18,"start":314,"end":315},{"type":"T_RPAREN","context":"normal","value":")","line":18,"start":315,"end":316},{"type":"T_RPAREN","context":"normal","value":")","line":18,"start":316,"end":317},{"type":"T_SEMICOLON","context":"normal","value":";","line":18,"start":317,"end":318},{"type":"T_RCURLY","context":"normal","value":"}","line":19,"start":323,"end":324},{"type":"T_COMMA","context":"normal","value":",","line":19,"start":324,"end":325},{"type":"T_NUMBER","context":"normal","value":"1000","line":19,"start":326,"end":330},{"type":"T_RPAREN","context":"normal","value":")","line":19,"start":330,"end":331},{"type":"T_SEMICOLON","context":"normal","value":";","line":19,"start":331,"end":332},{"type":"T_RCURLY","context":"normal","value":"}","line":20,"start":335,"end":336},{"type":"T_IDENTIFIER","context":"normal","value":"render","line":22,"start":340,"end":346},{"type":"T_LPAREN","context":"normal","value":"(","line":22,"start":346,"end":347},{"type":"T_RPAREN","context":"normal","value":")","line":22,"start":347,"end":348},{"type":"T_LCURLY","context":"normal","value":"{","line":22,"start":349,"end":350},{"type":"T_RETURN","context":"normal","value":"return","line":23,"start":355,"end":361},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":23,"start":362,"end":363},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"div","line":23,"start":363,"end":366},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":23,"start":366,"end":367},{"type":"T_JSX_TEXT","context":"jsxChild","value":"Count: ","line":23,"start":367,"end":374},{"type":"T_LCURLY","context":"normal","value":"{","line":23,"start":374,"end":375},{"type":"T_THIS","context":"normal","value":"this","line":23,"start":375,"end":379},{"type":"T_PERIOD","context":"normal","value":".","line":23,"start":379,"end":380},{"type":"T_IDENTIFIER","context":"normal","value":"state","line":23,"start":380,"end":385},{"type":"T_PERIOD","context":"normal","value":". You changed it to object literal syntax, which is invalid with string/boolean literals in parameters. Note: If you dont need to use the State type again you could also ","line":10,"start":161,"end":162},{"type":"T_IDENTIFIER","context":"normal","value":"doesNotExist","line":10,"start":162,"end":174},{"type":"T_SEMICOLON","context":"normal","value":";","line":10,"start":174,"end":175},{"type":"Line","context":"comment","value":"// Error! your component, Flow will statically ensure that you are using the component in the way it was designed to be used. Programmatically navigate using React router, How to pass props to {this.props.children}, How to set component default props on React component. ","line":10,"start":166,"end":207},{"type":"T_RCURLY","context":"normal","value":"}","line":11,"start":208,"end":209},{"type":"T_SEMICOLON","context":"normal","value":";","line":11,"start":209,"end":210},{"type":"Line","context":"comment","value":"// So we don't need to include foo.","line":13,"start":212,"end":247},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":14,"start":248,"end":249},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"MyComponent","line":14,"start":249,"end":260},{"type":"T_DIV","context":"jsxTag","value":"/","line":14,"start":261,"end":262},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":14,"start":262,"end":263},{"type":"T_SEMICOLON","context":"normal","value":";","line":14,"start":263,"end":264}],"errors":[]}. This can be bad if you have complex components that check the component idenitity to see if rerendering should be done. functional react components onclick event use

Why is the US residential model untouchable and unquestionable? How to encourage melee combat when ranged is a stronger option. }, eventually be deprecated (as per Dan Abramov, one of the core team). value from defaultProps. How do I inject a parent component into a child component? syntax. ","line":8,"start":153,"end":154},{"type":"T_IDENTIFIER","context":"normal","value":"Component","line":8,"start":154,"end":163},{"type":"T_LESS_THAN","context":"type","value":"<","line":8,"start":163,"end":164},{"type":"T_IDENTIFIER","context":"type","value":"Props","line":8,"start":164,"end":169},{"type":"T_GREATER_THAN","context":"type","value":">","line":8,"start":169,"end":170},{"type":"T_LCURLY","context":"normal","value":"{","line":8,"start":171,"end":172},{"type":"T_STATIC","context":"normal","value":"static","line":9,"start":175,"end":181},{"type":"T_IDENTIFIER","context":"normal","value":"defaultProps","line":9,"start":182,"end":194},{"type":"T_ASSIGN","context":"normal","value":"=","line":9,"start":195,"end":196},{"type":"T_LCURLY","context":"normal","value":"{","line":9,"start":197,"end":198},{"type":"T_IDENTIFIER","context":"normal","value":"foo","line":10,"start":203,"end":206},{"type":"T_COLON","context":"normal","value":":","line":10,"start":206,"end":207},{"type":"T_NUMBER","context":"normal","value":"42","line":10,"start":208,"end":210},{"type":"T_COMMA","context":"normal","value":",","line":10,"start":210,"end":211},{"type":"Line","context":"comment","value":"// but we have a default prop for foo. : string,\n};\n\nclass MyComponent extends React.Component {\n render() {\n this.props.doesNotExist; // Error! Thank you @Bergi.

How to access a method from app.component from other component? To subscribe to this RSS feed, copy and paste this URL into your RSS reader. JavaScript front end for Odin Project book library database, Story: man purchases plantation on planet, finds 'unstoppable' infestation, uses science, electrolyses water for oxygen, 1970s-1980s. First one can cause some hard-to-debug performance problems, especially if you are using redux. define it inline: extends React.Component<{ foo: number, bar? you can use a destructured approach, example : Thanks for contributing an answer to Stack Overflow! What's the difference between "super()" and "super(props)" in React when using es6 classes? Announcing the Stacks Editor Beta release! : string,\n};\n\nfunction MyComponent(props: Props) {\n props.doesNotExist; // Error! By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy.

React functional component default props vs default parameters, eventually be deprecated (as per Dan Abramov, one of the core team), github.com/croutonn/next-template/issues/27, How APIs can take the pain out of legacy system headaches (Ep. Adding Flow types to your React components is incredibly powerful. Why do you think it's not an answer? I thought it is a wrong syntax. You did not define a `doesNotExist` prop.","line":10,"start":176,"end":227},{"type":"T_RETURN","context":"normal","value":"return","line":12,"start":233,"end":239},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":12,"start":240,"end":241},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"div","line":12,"start":241,"end":244},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":12,"start":244,"end":245},{"type":"T_LCURLY","context":"normal","value":"{","line":12,"start":245,"end":246},{"type":"T_THIS","context":"normal","value":"this","line":12,"start":246,"end":250},{"type":"T_PERIOD","context":"normal","value":".","line":12,"start":250,"end":251},{"type":"T_IDENTIFIER","context":"normal","value":"props","line":12,"start":251,"end":256},{"type":"T_PERIOD","context":"normal","value":". When adding a new disk to RAID 1, why does it sync unused space? In a React functional component, which is the better approach to set default props, using Component.defaultProps, or using the default parameters on the function definition, examples: You can now choose to sort by Trending, which boosts votes that have happened recently, helping to surface more up-to-date answers. You did not define a `doesNotExist` prop.\n\n return

{this.props.bar}
;\n }\n}\n\n;\n","tokens":[{"type":"T_IMPORT","context":"normal","value":"import","line":1,"start":0,"end":6},{"type":"T_MULT","context":"normal","value":"*","line":1,"start":7,"end":8},{"type":"T_IDENTIFIER","context":"normal","value":"as","line":1,"start":9,"end":11},{"type":"T_IDENTIFIER","context":"normal","value":"React","line":1,"start":12,"end":17},{"type":"T_IDENTIFIER","context":"normal","value":"from","line":1,"start":18,"end":22},{"type":"T_STRING","context":"normal","value":"'react'","line":1,"start":23,"end":30},{"type":"T_SEMICOLON","context":"normal","value":";","line":1,"start":30,"end":31},{"type":"T_TYPE","context":"normal","value":"type","line":3,"start":33,"end":37},{"type":"T_IDENTIFIER","context":"type","value":"Props","line":3,"start":38,"end":43},{"type":"T_ASSIGN","context":"type","value":"=","line":3,"start":44,"end":45},{"type":"T_LCURLY","context":"type","value":"{","line":3,"start":46,"end":47},{"type":"T_IDENTIFIER","context":"normal","value":"foo","line":4,"start":50,"end":53},{"type":"T_COLON","context":"type","value":":","line":4,"start":53,"end":54},{"type":"T_NUMBER_TYPE","context":"type","value":"number","line":4,"start":55,"end":61},{"type":"T_COMMA","context":"type","value":",","line":4,"start":61,"end":62},{"type":"T_IDENTIFIER","context":"normal","value":"bar","line":5,"start":65,"end":68},{"type":"T_PLING","context":"type","value":"?","line":5,"start":68,"end":69},{"type":"T_COLON","context":"type","value":":","line":5,"start":69,"end":70},{"type":"T_STRING_TYPE","context":"type","value":"string","line":5,"start":71,"end":77},{"type":"T_COMMA","context":"type","value":",","line":5,"start":77,"end":78},{"type":"T_RCURLY","context":"type","value":"}","line":6,"start":79,"end":80},{"type":"T_SEMICOLON","context":"normal","value":";","line":6,"start":80,"end":81},{"type":"T_CLASS","context":"normal","value":"class","line":8,"start":83,"end":88},{"type":"T_IDENTIFIER","context":"normal","value":"MyComponent","line":8,"start":89,"end":100},{"type":"T_EXTENDS","context":"normal","value":"extends","line":8,"start":101,"end":108},{"type":"T_IDENTIFIER","context":"normal","value":"React","line":8,"start":109,"end":114},{"type":"T_PERIOD","context":"normal","value":".","line":8,"start":114,"end":115},{"type":"T_IDENTIFIER","context":"normal","value":"Component","line":8,"start":115,"end":124},{"type":"T_LESS_THAN","context":"type","value":"<","line":8,"start":124,"end":125},{"type":"T_IDENTIFIER","context":"type","value":"Props","line":8,"start":125,"end":130},{"type":"T_GREATER_THAN","context":"type","value":">","line":8,"start":130,"end":131},{"type":"T_LCURLY","context":"normal","value":"{","line":8,"start":132,"end":133},{"type":"T_IDENTIFIER","context":"normal","value":"render","line":9,"start":136,"end":142},{"type":"T_LPAREN","context":"normal","value":"(","line":9,"start":142,"end":143},{"type":"T_RPAREN","context":"normal","value":")","line":9,"start":143,"end":144},{"type":"T_LCURLY","context":"normal","value":"{","line":9,"start":145,"end":146},{"type":"T_THIS","context":"normal","value":"this","line":10,"start":151,"end":155},{"type":"T_PERIOD","context":"normal","value":".","line":10,"start":155,"end":156},{"type":"T_IDENTIFIER","context":"normal","value":"props","line":10,"start":156,"end":161},{"type":"T_PERIOD","context":"normal","value":". To add a type for state to your React class component then create a new object import React from 'react'.

For those using the eslint rule "require-default-props" and using ES6 default parameters, you can disable the rule for now: Could you expand on what it is about using. First one can cause some hard-to-debug performance problems, especially if you are using redux. In specific (in React context), the first is better since it is a main phase in the component lifecycle, namely, the initialization phase. Now that works fine, but if you have more complex component and state, such as react-redux connected components with database connection and/or react useffect hooks, and component state, this can cause a lot of rerending. Before we show how to type a React class component with Flow, let us first show All content on Query Threads is licensed under the Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0). In specific (in React context), the first is better since it is a main phase in the component lifecycle, namely, the initialization phase. We will learn more about state in the next section.

@AbdennourTOUMI Please don't destroy the default initialiser syntax! basic runtime checks. Here is the official announcement regarding the deprecation of the defaultProps. You did not define a `doesNotExist` prop.","line":9,"start":142,"end":193},{"type":"T_RETURN","context":"normal","value":"return","line":11,"start":197,"end":203},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":11,"start":204,"end":205},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"div","line":11,"start":205,"end":208},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":11,"start":208,"end":209},{"type":"T_LCURLY","context":"normal","value":"{","line":11,"start":209,"end":210},{"type":"T_IDENTIFIER","context":"normal","value":"props","line":11,"start":210,"end":215},{"type":"T_PERIOD","context":"normal","value":". default it is undefined so you can see in the example above we did not include lifecycle react props function arguments. ","line":11,"start":242,"end":243},{"type":"T_IDENTIFIER","context":"normal","value":"bar","line":11,"start":243,"end":246},{"type":"T_RCURLY","context":"normal","value":"}","line":11,"start":246,"end":247},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":11,"start":247,"end":248},{"type":"T_DIV","context":"jsxTag","value":"/","line":11,"start":248,"end":249},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"div","line":11,"start":249,"end":252},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":11,"start":252,"end":253},{"type":"T_SEMICOLON","context":"normal","value":";","line":11,"start":253,"end":254},{"type":"T_RCURLY","context":"normal","value":"}","line":12,"start":257,"end":258},{"type":"T_RCURLY","context":"normal","value":"}","line":13,"start":259,"end":260}],"errors":[]}, {"value":"import * as React from 'react';\n\ntype Props = {\n foo: number,\n bar? Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. react Note: You dont need to make foo nullable in your Props type. Asking for help, clarification, or responding to other answers.

import * as React from 'react' instead of as a default with rev2022.7.21.42639. Props and state. // Error! By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Remember, ReactJS was invented before ES6. How to specify (optional) default props with TypeScript for stateless, functional React components? ","line":9,"start":127,"end":128},{"type":"T_IDENTIFIER","context":"normal","value":"doesNotExist","line":9,"start":128,"end":140},{"type":"T_SEMICOLON","context":"normal","value":";","line":9,"start":140,"end":141},{"type":"Line","context":"comment","value":"// Error! ","line":11,"start":215,"end":216},{"type":"T_IDENTIFIER","context":"normal","value":"bar","line":11,"start":216,"end":219},{"type":"T_RCURLY","context":"normal","value":"}","line":11,"start":219,"end":220},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":11,"start":220,"end":221},{"type":"T_DIV","context":"jsxTag","value":"/","line":11,"start":221,"end":222},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"div","line":11,"start":222,"end":225},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":11,"start":225,"end":226},{"type":"T_SEMICOLON","context":"normal","value":";","line":11,"start":226,"end":227},{"type":"T_RCURLY","context":"normal","value":"}","line":12,"start":228,"end":229},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":14,"start":231,"end":232},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"MyComponent","line":14,"start":232,"end":243},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"foo","line":14,"start":244,"end":247},{"type":"T_ASSIGN","context":"jsxTag","value":"=","line":14,"start":247,"end":248},{"type":"T_LCURLY","context":"normal","value":"{","line":14,"start":248,"end":249},{"type":"T_NUMBER","context":"normal","value":"42","line":14,"start":249,"end":251},{"type":"T_RCURLY","context":"normal","value":"}","line":14,"start":251,"end":252},{"type":"T_DIV","context":"jsxTag","value":"/","line":14,"start":253,"end":254},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":14,"start":254,"end":255}],"errors":[]}, {"value":"import * as React from 'react';\n\ntype Props = {\n foo: number, // foo is required.\n};\n\nfunction MyComponent(props: Props) {}\n\nMyComponent.defaultProps = {\n foo: 42, // but we have a default prop for foo.\n};\n\n// So we don't need to include foo.\n;\n","tokens":[{"type":"T_IMPORT","context":"normal","value":"import","line":1,"start":0,"end":6},{"type":"T_MULT","context":"normal","value":"*","line":1,"start":7,"end":8},{"type":"T_IDENTIFIER","context":"normal","value":"as","line":1,"start":9,"end":11},{"type":"T_IDENTIFIER","context":"normal","value":"React","line":1,"start":12,"end":17},{"type":"T_IDENTIFIER","context":"normal","value":"from","line":1,"start":18,"end":22},{"type":"T_STRING","context":"normal","value":"'react'","line":1,"start":23,"end":30},{"type":"T_SEMICOLON","context":"normal","value":";","line":1,"start":30,"end":31},{"type":"T_TYPE","context":"normal","value":"type","line":3,"start":33,"end":37},{"type":"T_IDENTIFIER","context":"type","value":"Props","line":3,"start":38,"end":43},{"type":"T_ASSIGN","context":"type","value":"=","line":3,"start":44,"end":45},{"type":"T_LCURLY","context":"type","value":"{","line":3,"start":46,"end":47},{"type":"T_IDENTIFIER","context":"normal","value":"foo","line":4,"start":50,"end":53},{"type":"T_COLON","context":"type","value":":","line":4,"start":53,"end":54},{"type":"T_NUMBER_TYPE","context":"type","value":"number","line":4,"start":55,"end":61},{"type":"T_COMMA","context":"type","value":",","line":4,"start":61,"end":62},{"type":"Line","context":"comment","value":"// foo is required.","line":4,"start":63,"end":82},{"type":"T_RCURLY","context":"type","value":"}","line":5,"start":83,"end":84},{"type":"T_SEMICOLON","context":"normal","value":";","line":5,"start":84,"end":85},{"type":"T_FUNCTION","context":"normal","value":"function","line":7,"start":87,"end":95},{"type":"T_IDENTIFIER","context":"normal","value":"MyComponent","line":7,"start":96,"end":107},{"type":"T_LPAREN","context":"normal","value":"(","line":7,"start":107,"end":108},{"type":"T_IDENTIFIER","context":"normal","value":"props","line":7,"start":108,"end":113},{"type":"T_COLON","context":"type","value":":","line":7,"start":113,"end":114},{"type":"T_IDENTIFIER","context":"type","value":"Props","line":7,"start":115,"end":120},{"type":"T_RPAREN","context":"normal","value":")","line":7,"start":120,"end":121},{"type":"T_LCURLY","context":"normal","value":"{","line":7,"start":122,"end":123},{"type":"T_RCURLY","context":"normal","value":"}","line":7,"start":123,"end":124},{"type":"T_IDENTIFIER","context":"normal","value":"MyComponent","line":9,"start":126,"end":137},{"type":"T_PERIOD","context":"normal","value":". Flow will infer the type of your default props from static defaultProps so you After typing Props with the same shape as the prop types but using Flows static type {"value":"import React from 'react';\nimport PropTypes from 'prop-types';\n\nclass MyComponent extends React.Component {\n static propTypes = {\n foo: PropTypes.number.isRequired,\n bar: PropTypes.string,\n };\n\n render() {\n return

{this.props.bar}
;\n }\n}\n","tokens":[{"type":"T_IMPORT","context":"normal","value":"import","line":1,"start":0,"end":6},{"type":"T_IDENTIFIER","context":"normal","value":"React","line":1,"start":7,"end":12},{"type":"T_IDENTIFIER","context":"normal","value":"from","line":1,"start":13,"end":17},{"type":"T_STRING","context":"normal","value":"'react'","line":1,"start":18,"end":25},{"type":"T_SEMICOLON","context":"normal","value":";","line":1,"start":25,"end":26},{"type":"T_IMPORT","context":"normal","value":"import","line":2,"start":27,"end":33},{"type":"T_IDENTIFIER","context":"normal","value":"PropTypes","line":2,"start":34,"end":43},{"type":"T_IDENTIFIER","context":"normal","value":"from","line":2,"start":44,"end":48},{"type":"T_STRING","context":"normal","value":"'prop-types'","line":2,"start":49,"end":61},{"type":"T_SEMICOLON","context":"normal","value":";","line":2,"start":61,"end":62},{"type":"T_CLASS","context":"normal","value":"class","line":4,"start":64,"end":69},{"type":"T_IDENTIFIER","context":"normal","value":"MyComponent","line":4,"start":70,"end":81},{"type":"T_EXTENDS","context":"normal","value":"extends","line":4,"start":82,"end":89},{"type":"T_IDENTIFIER","context":"normal","value":"React","line":4,"start":90,"end":95},{"type":"T_PERIOD","context":"normal","value":".","line":4,"start":95,"end":96},{"type":"T_IDENTIFIER","context":"normal","value":"Component","line":4,"start":96,"end":105},{"type":"T_LCURLY","context":"normal","value":"{","line":4,"start":106,"end":107},{"type":"T_STATIC","context":"normal","value":"static","line":5,"start":110,"end":116},{"type":"T_IDENTIFIER","context":"normal","value":"propTypes","line":5,"start":117,"end":126},{"type":"T_ASSIGN","context":"normal","value":"=","line":5,"start":127,"end":128},{"type":"T_LCURLY","context":"normal","value":"{","line":5,"start":129,"end":130},{"type":"T_IDENTIFIER","context":"normal","value":"foo","line":6,"start":135,"end":138},{"type":"T_COLON","context":"normal","value":":","line":6,"start":138,"end":139},{"type":"T_IDENTIFIER","context":"normal","value":"PropTypes","line":6,"start":140,"end":149},{"type":"T_PERIOD","context":"normal","value":".","line":6,"start":149,"end":150},{"type":"T_IDENTIFIER","context":"normal","value":"number","line":6,"start":150,"end":156},{"type":"T_PERIOD","context":"normal","value":".","line":6,"start":156,"end":157},{"type":"T_IDENTIFIER","context":"normal","value":"isRequired","line":6,"start":157,"end":167},{"type":"T_COMMA","context":"normal","value":",","line":6,"start":167,"end":168},{"type":"T_IDENTIFIER","context":"normal","value":"bar","line":7,"start":173,"end":176},{"type":"T_COLON","context":"normal","value":":","line":7,"start":176,"end":177},{"type":"T_IDENTIFIER","context":"normal","value":"PropTypes","line":7,"start":178,"end":187},{"type":"T_PERIOD","context":"normal","value":".","line":7,"start":187,"end":188},{"type":"T_IDENTIFIER","context":"normal","value":"string","line":7,"start":188,"end":194},{"type":"T_COMMA","context":"normal","value":",","line":7,"start":194,"end":195},{"type":"T_RCURLY","context":"normal","value":"}","line":8,"start":198,"end":199},{"type":"T_SEMICOLON","context":"normal","value":";","line":8,"start":199,"end":200},{"type":"T_IDENTIFIER","context":"normal","value":"render","line":10,"start":204,"end":210},{"type":"T_LPAREN","context":"normal","value":"(","line":10,"start":210,"end":211},{"type":"T_RPAREN","context":"normal","value":")","line":10,"start":211,"end":212},{"type":"T_LCURLY","context":"normal","value":"{","line":10,"start":213,"end":214},{"type":"T_RETURN","context":"normal","value":"return","line":11,"start":219,"end":225},{"type":"T_LESS_THAN","context":"jsxTag","value":"<","line":11,"start":226,"end":227},{"type":"T_JSX_IDENTIFIER","context":"jsxTag","value":"div","line":11,"start":227,"end":230},{"type":"T_GREATER_THAN","context":"jsxTag","value":">","line":11,"start":230,"end":231},{"type":"T_LCURLY","context":"normal","value":"{","line":11,"start":231,"end":232},{"type":"T_THIS","context":"normal","value":"this","line":11,"start":232,"end":236},{"type":"T_PERIOD","context":"normal","value":".","line":11,"start":236,"end":237},{"type":"T_IDENTIFIER","context":"normal","value":"props","line":11,"start":237,"end":242},{"type":"T_PERIOD","context":"normal","value":".