Comments (10)
I +1 this big time! I have been putting out the feelers to what the community use and the general consensus I feel is whatever suits.
As an example from the MeteorJS community, Iron Router is freaking ace! It's key-concepts are worth looking at and I think a react specific router using this as a reference would be a great library for development.
from generator-react-webpack.
The reason we haven't come up with a great one is because we would want it to work on both server and client transparently. But that makes the problem a lot more complicated and we can incrementally get there by starting on client-only first.
One example is what we do in todomvc: https://github.com/tastejs/todomvc/blob/gh-pages/labs/architecture-examples/react/js/app.jsx#L31. But if Iron Router is better we can use that.
from generator-react-webpack.
Iron Router is specific to MeteorJS as far as I am aware, dunno how easy it would be to port though....
A very quick nose around the source and it appears the core of Iron Router could be re-used e.g. router.js. The client and server specific elements seem to hold the majority of MeteorJS logic...
from generator-react-webpack.
react-router seems to hit the nail on the head with all the requirements http://andreypopp.viewdocs.io/react-router-component
from generator-react-webpack.
@ryanseddon I agree and I will try and set aside some time to integrate into this generator as an optional include (unless someone else beats me to it 🐎 )
from generator-react-webpack.
How does the routing work currently? I see paths that the browser interprets as "script/components" which sets relative paths to ../../styles/ so its seemingly 1:1 from the filesystem.
from generator-react-webpack.
Done :) @petehunt etc
from generator-react-webpack.
Sorry to comment on such an old issue, but is this react-router
still part of this generator? I'm not seeing in in the generator command prompts, and I don't see it documented (it's addition on removal) in the changelog.
from generator-react-webpack.
Hi @RobErskine,
the generator does not have support for flux or react-router anymore. This was done in version 2.0, because we wanted it to be easier to maintain (see https://github.com/newtriks/generator-react-webpack#changes-in-version-20). For flux frameworks, there are currently at least 2 other generators using generator-react-webpack as base (reflux and alt.js). Both are linked to in the README.
Installing react-router is easy as:
npm install --save react-router
// Update run.js:
import { Router } from 'react-router';
import history from '../utils/History.js';
ReactDOM.render(
<Router history={history}>
// YOUR ROUTES HERE
</Router>,
document.getElementById('app')
);
// Create src/utils/History.js
import { createHistory } from 'history';
export default createHistory();
// Update the main component:
require('reset.css');
require('styles/App.less');
import React from 'react';
class AppComponent extends React.Component {
render() {
return (
<div className="layout">
{this.props.children}
</div>
);
}
}
export default AppComponent;
Hope this helps.
from generator-react-webpack.
Thanks @weblogixx, that's great. I didn't realize react-router was part of the flux strip out overhaul done in 2.0.
from generator-react-webpack.
Related Issues (20)
- Running the generator throws error on expected promise object at the beginning of execution
- NPM Run Dist won't copy over all image assets
- SyntaxError: Unexpected token: name (path) [./cfg/base.js:2,0] when running dist
- Optionally use HtmlWebpackPlugin
- Static files
- how to add postCss plugin,please tell me details of it
- Redux link in README.md seems incorrect
- Hot reloader not working. HOT 1
- Setup Issue
- Generate A Container?
- Cannot read property 'apply' of undefined
- Missing node modules when deploying to Heroku HOT 1
- impossible to use any node package added
- How can I set webpack proxy in cfg/base.js
- When you choose Scss in the installation - all generated files are .css
- install warn HOT 1
- "Uncaught SyntaxError: Unexpected token <" on Production Server
- React Version is Old
- Error trying to run npm run dist
- How can auto open the browser?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-react-webpack.