Starting by checking the documentation on Griddle.
Griddle is a simple grid Component for use with React. It depends on Lodash Modules and React.
To use Griddle:
npm install griddle-react
Running a variation in this Jupyter notebook.
In [1]:
!npm install --save griddle-react
In [2]:
!npm install --save react
In [3]:
!npm install --save lodash
Trying it out in this Jupyter notebook.
In [4]:
var React = require('react');
var Griddle = require('griddle-react');
At the most basic level, using Griddle is as simple as wiring up an array of JSON objects as a property to the component. First off, include Underscore and React. Include Griddle and the stylesheet before your React Code.
Please take a look at a basic gulp example…
Use curl
to get the gulp.js
file…
In [7]:
!curl -O https://raw.githubusercontent.com/ryanlanciaux/griddle-gulp-test/master/gulpfile.js
In [9]:
!cat gulpfile.js
Install the requirements from gulpfile.js
npm install --save gulp gulp-browserify gulp-concat
Output too long to display.
In [20]:
!gulp
And now there is a build/main.js
file.
When a server is run in a cloned directory of griddle-gulp-test, I see the expected result.
When a server is run in a directory of files I am currently creating, an exception is thrown.
Test for differences in key files.
In [26]:
!diff gulpfile.js griddle-gulp-test/gulpfile.js
In [31]:
!diff index.html griddle-gulp-test/index.html
After replacing the dependencies attributes of package.json with these lines from the example test, deleting the ./node_modules directory, and running npm install
the example I wrote works as expected. Somewhere some packages were not compatible with each other.
To test, I added some code to the source *.js file:
const MongoClient = require('mongodb').MongoClient,
assert = require('assert'),
// Connection URL
url = 'mongodb://localhost:27017/app',
message = "Connected successfully to MongoDB server.";
// Use connect method to connect to the server
MongoClient.connect(url, function(err, db){
assert.equal(null, err);
console.log(message);
db.close();
});
ran gulp
to add the code to ./build/main.js
And discovered that currently using mongodb inside the browser is not supported.
And now that I give this some closer thought, it makes perfect sense. How could a browser have access to a MongoDB instance on localhost when a client browser is unlikely to be local?! It's a different context. It becomes more apparent a need for an object data manager. Though from the response to the issue filed here it might be possible in the future.
Looks like the answer is to build a REST API for the data. And that would be the topic for another notebook.
And that is a topic for another notebook.
Developing a REST API enables us to create a foundation upon which we can build all other applications. As previously mentioned, these applications may be web-based or designed for specific platforms, such as Android or iOS.