나는 내용입니다.서울 파일에 다음과 같은 코드:
import React from "react";
import {createPortal} from 'react-dom';
import Text from './Text';
console.log(`Content script...`);
createPortal(
<Text/>,
document.body
);
""텍스트 구성품 코드:
import React from 'react';
const Text = () => {
return (
<div>
Just text...
</div>
);
};
export default Text;
내 매니페스트 포함됩니다:
...other keys
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["./static/js/content.js"],
"run_at": "document_end"
}
]
당신이 볼 수 있는 파일을 로드하는 메시지 Content script ...
인쇄합니다.
https://i.stack.imgur.com/GS0gK.png
하지만 div 텍스트 Just text...
를 추가하지 않고,몸에서 다른 말로,createPortal 작동하지 않습니다.
https://i.stack.imgur.com/j2geh.png