-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Link to library examples using Create React App #737
Comments
"Boilerplate" examples that use CRA for build setup and showcase how to do something in React are welcome too! Please let me know if you find or create any. |
Creact-react-app and ParseServer API https://github.com/zebapy/create-react-app-parse-redux |
I'll be creating some examples for https://github.com/smalldots/smalldots using CRA soon, but it's not ready yet :( |
This is where I first came across CRA: https://github.com/marmelab/admin-on-rest/blob/master/docs/Tutorial.md |
This might fall under boilerplate example - component-template. It's built with CRA to help enable folks to publish components built on top of reactstrap or react components in general. Planning to add a getting started guide to reactstrap that uses CRA as well. Happy to hear feedback on this use or abuse of CRA : ] |
https://github.com/vinpac/base-kit It comes with redux, react-router 4, basic components ( e.g. Dropdown, Modal ), sass support and a configurable and awesome style library based on bootstrap 4. Example of use ( based on Stripe layout ): https://vinpac.github.io/base-kit/ |
Here is good list of popular React libraries (and here’s a better one). For those that offer components and have examples with custom build setups and don’t need server rendering or exotic features, let’s send PRs that use Create React App for example code? If the authors don’t them, let’s also collect feedback in this thread. Please comment if you’d like to help out with this!
How to do it:
|
Yeah, this is the only list I found so far but it shouldn’t be hard to compile a better one (or use “awesome” and “ecosystem” lists). You’re welcome to add more lists in comments, and I’ll put them into the post. |
I would love to see a Visual Studio Code Extension for react-create-app that also generates required vscode configuration. A sample vscode configuration can be found in this boilerplate project: https://github.com/skolmer/react-hot-boilerplate-vscode |
@gaearon I'll take a look at updating react-loader |
As @gaearon said, this is a pretty good list too for react tools: awesome list |
@gaearon I'll take react-intl |
I spent an entire day getting the information from https://react.parts/ and it was painful. I'd love if we could ask the authors of that website for the information as they already have it in their db rather than trying to crawl it again. |
What's the recommended process for setting up an examples folder. Should you comment the dist code from the libraries build task then reference this in the examples? |
Not sure what you mean, could you clarify? You can look at Redux examples folder to see how CRA can be used in this context. |
My thinking is if the library has an examples folder e.g.
inside the examples and importing the library should this be from the dist version or from npm? Sorry is this is still vauge. Is there a link to the examples in Redux where CRA is being used? |
I think importing from npm is the best way. (Author may not agree, but this is why I’m saying we collect feedback.) The reason I prefer importing from npm is because people often try to copy-paste examples as top-level folders and try to play with them, and importing library source doesn’t really work in that scenario. |
Please see my review of this PR: formatjs/formatjs#669 (review). I think it’s important we don’t add unnecessary files, preserve original intention (like important |
Hey, I'm running into an issue. belle is using Ejecting CRA won't follow the point of this thread to make it easy for beginners to understand examples right? So is there another solution or should we not consider updating belle example anymore @gaearon? |
I suggest using stage 2 Class Properties proposal instead. It is supported by Create React App because we use it at Facebook, and if its syntax changes, we’ll make sure to release a codemod to automatically migrate the code for Create React App users. Here is how equivalent code looks like with Class Properties: _renderDay(day) {
const date = day.getDate();
return (
<div onMouseDown={this._onMouseDown}>
🎁{ date }
</div>
);
}
_onMouseDown = (event) => {
event.stopPropagation();
} If you’re confused about the changes, I removed Update: actually, this won’t work in that file since |
That was a quick answer, thanks! |
As I noted before, I’d recommend making examples use library version from npm: #737 (comment). In this case library components would all be compiled. I don’t know whether it works well for Belle authors, but it’s worth suggesting. It’s always possible to use |
That said DatePickerPlayground.js is definitely in |
I am going to migrate spectacle-boilerplate. |
So I might be asking my stupid question of the day, but the first thing I did when I came across create-react-app was to attempt to outsource my library example website build hell to it. However, in the end I couldn't work out how to refer to my own ES6 source, which resided outside of the create-react-app created src/ dir. Since one on the main uses (for me, and since this issue invites comments on use cases that might not work) in having an example directory is to develop my library against, importing from npm didn't seem like a great way to go (I can see in other cases that might be ok). I want to build a new example, or modify and existing one, get my code working, and only then publish to npm. So instead I made my whole project a CRA project, with its src/ dir, then under that my own source directory called components/ and another directory called examples/. This worked, but I'm not super excited about the structure. |
I believe I mentioned this in a comment before: #737 (comment). I also used to link examples to the source. However I've stopped doing it now because of all the people who try to run them as standalone apps and who can't figure out why configuration breaks once you extract the example into a standalone folder outside the project. So these days I don't use webpack config for that, and instead use |
@gaearon yes, I read that comment, but from a library author's perspective, I'm explaining why that isn't a workable solution. At least for me. But you clearly understand the use case and the downside, so my work is done here. |
@gaearon I'll take react-countup |
@gaearon What about web apps created with create-react-app? |
@gaearon I'm getting a lot of warnings with belle. CRA is using react 15.3.2 and belle 15.0.0-rc.2. The author blocked the version in the packages.json ( Examples with CRA are running fine though. For info, these are the warnings I get: |
Updating React should be a separate PR but I understand it might be a large undertaking. I’m sure Belle users would appreciate it though! |
@tbillington That would be cool too! |
@gaearon I pushed a PR for |
@gaearon I'll take a look at react-motion |
@gaearon I pushed a PR for react-countup |
@gaearon I'll take a look at react-google-login-component |
@gayancharith thank you for the PR! You think you can make one for the react-facebook-login-component? |
@kennetpostigo sure I will |
For anyone who ends up here an looking for a good React library starting point that uses |
This is an example project for using router v4, redux, ant design and react-intl with create-react-app. |
I would like to compile a list of React-related libraries whose examples use Create React App for build setup. Redux examples except for the universal and counter-vanilla all use it. React Router 4 examples are all copy-pasteable into App.js generated with Create React App.
Please help me find more such examples!
Update: help wanted porting libraries! See the instructions below.
The text was updated successfully, but these errors were encountered: