Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 jsx syntax used in js file #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lczzlczz
Copy link
Contributor

@lczzlczz lczzlczz commented Sep 14, 2022

  • 提交符合commit规范
  • 文档更改
  • 测试用例添加
  • npm run test通过
详细描述

JSX syntax is used in a js file, change it from sugar to function calls.

From:

return <div style={{ width, height }} ref={ref} />;

To:

return createElement("div", {
      style: {
        width,
        height,
      },
      ref,
    });
  • 特性
  • 关联issue

Comment on lines +42 to +48
return createElement("div", {
style: {
width,
height,
},
ref,
});
Copy link
Contributor Author

@lczzlczz lczzlczz Sep 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use createElement function to create <div> element.

Comment on lines +53 to +76
width: PropTypes.string,
name: PropTypes.string,
loading: PropTypes.element,
url: PropTypes.string,
alive: PropTypes.bool,
fetch: PropTypes.func,
props: PropTypes.object,
attrs: PropTypes.object,
replace: PropTypes.func,
sync: PropTypes.bool,
prefix: PropTypes.object,
fiber: PropTypes.bool,
degrade: PropTypes.bool,
plugins: PropTypes.array,
beforeLoad: PropTypes.func,
beforeMount: PropTypes.func,
afterMount: PropTypes.func,
beforeUnmount: PropTypes.func,
afterUnmount: PropTypes.func,
activated: PropTypes.func,
deactivated: PropTypes.func,
loadError: PropTypes.func,
};
Copy link
Contributor Author

@lczzlczz lczzlczz Sep 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change indentation from 4 spaces to 2 spaces.

Comment on lines -62 to -76
import React from "react";
import React, { createElement } from "react";
import PropTypes from "prop-types";
import { bus, setupApp ,preloadApp, startApp, destroyApp } from "wujie";
import { bus, preloadApp, startApp, destroyApp, setupApp } from "wujie";

export default class WujieReact extends React.PureComponent {
static propTypes = {
height: PropTypes.string,
width: PropTypes.string,
name: PropTypes.string,
loading: PropTypes.element;
url: PropTypes.string,
alive: PropTypes.bool,
fetch: PropTypes.func,
props: PropTypes.object,
replace: PropTypes.func,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align to packages/wujie-react/index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant