--- id: 5a24c314108439a4d403616c title: Override Default Props challengeType: 6 isRequired: false videoUrl: '' localeTitle: Substituir Adereços Padrão --- ## Description
A capacidade de definir props padrão é um recurso útil no React. A maneira de substituir os props padrão é definir explicitamente os valores prop para um componente.
## Instructions
O componente ShoppingCart agora renderiza um Items filho. Esse componente Items tem uma quantity prop padrão definida para o inteiro 0 . Substitua o prop padrão, passando um valor de 10 para quantity . Nota: Lembre - se de que a sintaxe para adicionar um suporte a um componente é semelhante à forma como você adiciona atributos HTML. No entanto, como o valor da quantity é um número inteiro, ele não será colocado entre aspas, mas deverá ser colocado em chaves. Por exemplo, {100} . Essa sintaxe diz ao JSX para interpretar o valor dentro das chaves diretamente como JavaScript.
## Tests
```yml tests: - text: O componente ShoppingCart deve renderizar. testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("ShoppingCart").length === 1; })(), "The component ShoppingCart should render.");' - text: Os Items componentes devem renderizar. testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("Items").length === 1; })(), "The component Items should render.");' - text: 'O componente Items deve ter um prop de { quantity: 10 } passado do componente ShoppingCart .' testString: 'getUserInput => assert((function() { const mockedComponent = Enzyme.mount(React.createElement(ShoppingCart)); return mockedComponent.find("Items").props().quantity == 10 && getUserInput("index").replace(/ /g,"").includes(""); })(), "The Items component should have a prop of { quantity: 10 } passed from the ShoppingCart component.");' ```
## Challenge Seed
```jsx const Items = (props) => { return

Current Quantity of Items in Cart: {props.quantity}

} Items.defaultProps = { quantity: 0 } class ShoppingCart extends React.Component { constructor(props) { super(props); } render() { { /* change code below this line */ } return { /* change code above this line */ } } }; ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```