ampproject / ampproject/ampstart

Getting errors while trying to added a Material Ui component with AMP

Open
#911 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
415
Forks
147
PR merge metrics
No merged PRs in 30d

Description

I made a very simple page to test AMP with Material UI and Next JS, However, when I try to render this page

`import React from 'react'`
`import Button from '@material-ui/core/Button'`

`const testamp = () => {`
` return (`
`

`
` Hello World`
` `
` LOGIN`
` `
`
`
` )`
`}`
`export default testamp`
`export const config = { amp: true } `

I get the following error:

`/testamp error The parent tag of tag 'style amp-custom' is 'div', but it can only be 'head'. `
`error The parent tag of tag 'style amp-custom' is 'div', but it can only be 'head'.`
`error The parent tag of tag 'style amp-custom' is 'button', but it can only be 'head'.`

what could be the problem here ? specially that I just added a very simple component here with no styling

Contributor guide

Open the contributing guide

Research direction

Start from the shown `testamp` page and its `amp: true` configuration, then reproduce the AMP validation errors with the Material UI `Button`. Compare the rendered output with AMP's requirement that `style amp-custom` be under `head`; done means the page renders without these validation errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, nextjs, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.