GithubHelp home page GithubHelp logo

krakenjs / jsx-pragmatic Goto Github PK

View Code? Open in Web Editor NEW
185.0 13.0 29.0 532 KB

Build JSX structures, then decide at runtime which pragma you want to use to render them.

License: Apache License 2.0

JavaScript 99.84% Shell 0.16%
hacktoberfest

jsx-pragmatic's People

Contributors

amyegan avatar bluepnume avatar dimitrinicolas avatar dtjones404 avatar iam-agf avatar jadutter avatar mstuart avatar seavenly avatar westeezy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsx-pragmatic's Issues

How to handle events?

Thanks for great project!

If only we can render jsx to html,so what is the different with string template.

Children can only be passed as attributes

First of all thank you, this is a really interesting and promising library.

I'm trying to get the hang of the library and was setting up some basic components. Unless I'm messing something, children can only be passed as attributes:

For Example:
<ActionItem className="ASD DSA SDA" ariaLabel="Download" children="file_download" />

Works and children inside action item is "file_download"

<ActionItem className="ASD DSA SDA" ariaLabel="Download">file_download</ActionItem>

does not work, children is undefined.

Here is ActionItem

import { node } from 'jsx-pragmatic';

interface DestructTypes {
  className: string;
  ariaLabel: string;
  children: string | Element;
};

export default function ActionItem({ className, ariaLabel, children }: DestructTypes) {
  const classes = "material-icons mdc-top-app-bar__action-item " + className;
  console.log(children);
  return (
    <a
    href="#"
    className={classes}
    aria-label={ariaLabel}>
      {children}
    </a>
  );
}

Thanks

render with container id throws TypeError

Hey, I am trying to add some html to a div container like in the paypal checkout with the button. I used the demo for that but unfortunately its not working.

index.html

<head>
	<title>JSX Pragmatic Dev Demo</title>
</head>

<body>
  <div id="test"></div>
  <script src="/jsx-pragmatic-demo.js"></script>
</body>

index.jsx:

/* @flow */
/* @jsx node */

import { node, dom } from '../../src';

export function login() {

  return (
    <section>
      <input type="text" placeholder="email" />
      <input type="password" placeholder="password" />
      <button>Log In</button>
    </section>
  );
}

// console.log(login());
login().render('#test')

Output

Uncaught TypeError: renderer is not a function
    at ElementNode._proto.render (VM1088 jsx-pragmatic-demo.js:97)
    at Module.<anonymous> (VM1088 jsx-pragmatic-demo.js:257)
    at __webpack_require__ (VM1088 jsx-pragmatic-demo.js:13)
    at VM1088 jsx-pragmatic-demo.js:61
    at VM1088 jsx-pragmatic-demo.js:62
    at VM1088 jsx-pragmatic-demo.js:2
    at VM1088 jsx-pragmatic-demo.js:3

And another question: When using with dom() I only get the code back when console.logging it. I thought it would render to to page automatically?!

Create TypeScript typings

This project isn't written in TypeScript, but many TypeScript users would like to use published typings. For this issue, create TypeScript typings that cover the exported functions, and contribute it back to DefinitelyTyped!

This issue is great for someone who wants to learn more about TypeScript!

className not converting to class

Hey, sorry if this is related to my other open issue...

When I use className in my jsx components, it eventually converts to classname instead of class.

Was this intended as well?

Thanks

Create a CHANGELOG.md file

  • Create a Changelog based on the keep a Changelog format
  • Update the Changelog with at least the last five commits.
  • Keep the Changelog updated when a new version gets released.
  • Use the Unreleased section to track unreleased changes.

Props of type number not working

When I use the following component with a number has property:

interface Props {
  count: number;
}
export function Hello({ count }: Props) {
    return <p>Hello world {count}</p>;
}

I get the following error:

(node:14748) UnhandledPromiseRejectionWarning: TypeError: Unrecognized node type: number
    at normalizeChildren (/node_modules/jsx-pragmatic/dist/webpack:/pragmatic/src/node.js:159:6)

Did I do something wrong? Or do I miss some settings?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.