Skip to content

Add setup function, to wrap componentDidMount #10

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

Merged
merged 11 commits into from
Feb 21, 2018
Prev Previous commit
Next Next commit
Add component function, and example
  • Loading branch information
paf31 committed Feb 15, 2018
commit 330b15f035d80765f701a993cd50d20185dc40a1
3 changes: 3 additions & 0 deletions examples/component/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output
html/index.js
node_modules
5 changes: 5 additions & 0 deletions examples/component/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all:
purs compile src/*.purs '../../src/**/*.purs' '../../bower_components/purescript-*/src/**/*.purs'
purs bundle --module Container output/*/*.js > output/bundle.js
echo 'module.exports = PS.Container;' >> output/bundle.js
node_modules/browserify/bin/cmd.js output/bundle.js index.js -o html/index.js
12 changes: 12 additions & 0 deletions examples/component/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Component Example

## Building

```
npm install
make all
```

This will compile the PureScript source files, bundle them, and use Browserify to combine PureScript and NPM sources into a single bundle.

Then open `html/index.html` in your browser.
10 changes: 10 additions & 0 deletions examples/component/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>react-basic example</title>
</head>
<body>
<div id="container"></div>
<script src="index.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions examples/component/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use strict";

var React = require("react");
var ReactDOM = require("react-dom");
var Container = require("./output/bundle.js");

ReactDOM.render(
React.createElement(Container.component, { label: 'Increment' }),
document.getElementById("container")
);
Loading