Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
react made easy
npm install bae --save
Add these 2 lines in your package.json
"scripts": {
"dev": "bae dev",
"start": "bae"
}
Start the dev server with npm run dev
. You just setup server rendering with hot module replacement and hot reload!
Make pages like it's the 90s.
pages are routes: pages/about
renders /about
of your website
pages are rendered on the server
pages are streamed
to the browser for quick time-to-first-byte
built in code splitting, each page gets it's own page.js
code shared between pages is served as common.js
for long term caching
pages/home.js
renders the homepage /
import React from 'react'
export default class extends React.Component {
constructor (props) {
super(props)
this.state = {message: 'hello'} // rendered on the server
}
componentDidMount () {
this.setState({message: 'hello world'}) // updated on the browser
}
render () {
return <div>{this.state.message}</div>
}
}
React has a lifecycle method that get's called on the server componentWillMount
that can be used to set data for server rendering. But, it does not support asynchronous data fetching before rendering the component.
bae introduces a new lifecycle method to pages that runs only on the server.
import React from 'react'
export default class extends React.Component {
constructor (props) {
super(props)
this.state = {username: 'siddharthkp'}
}
asyncComponentWillMount () {
/*
Return a promise.
It will get resolved on the server and passed as props to the component.
*/
return axios.get(`https://api.github.com/users/${this.state.username}`)
}
render () {
return <div>{this.props.bio}</div>
}
}
the usual, nothing special here.
comes with styled-components which gets rendered on the server.
keep your images, fonts, etc. in a directory named static
npm start
will compile, optimize and serve your app.
Check out the example applications to see how simple this is.
:star: this repo
MIT © siddharthkp
FAQs
react made easy
The npm package bae receives a total of 3 weekly downloads. As such, bae popularity was classified as not popular.
We found that bae demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.